Re: [PATCH 2 of 2] Core: add ngx_atomic_store() and ngx_atomic_load()

2016-09-16 Thread Maxim Dounin
Hello! On Fri, Sep 16, 2016 at 02:43:49PM -0700, Piotr Sikora wrote: > Hey Maxim, > > > The "*(lock) == 0" check here is just an optimization, it only > > ensures that the lock is likely to succed. > > Yes, and use of the ngx_atomic_load() doesn't affect that. > > Namely, in the micro-benchmar

Re: nginx timer in log module

2016-09-16 Thread 洪志道
Thank you for your reply, I get it now. In other case such as I showed above, it seems we needn't do like the following ? if (ev->timer_set) { ngx_del_timer(ev); } 2016-09-17 10:48 GMT+08:00 Maxim Dounin : > Hello! > > On Sat, Sep 17, 2016 at 08:25:54AM +0800, 洪志道 wrote: > > [...] > > >

Re: nginx timer in log module

2016-09-16 Thread Maxim Dounin
Hello! On Sat, Sep 17, 2016 at 08:25:54AM +0800, 洪志道 wrote: [...] > static void > ngx_http_log_flush(ngx_open_file_t *file, ngx_log_t *log) > { > ... > if (buffer->event && buffer->event->timer_set) { > ngx_del_timer(buffer->event); > } > } > > > I find there are two functi

Re: nginx timer in log module

2016-09-16 Thread 洪志道
Well, I get it. By the way, If I want to add a timer, it can do something like crontab in worker process. For example, we collect data in worker process and dump the data every 5 minutes. event->cancelable = 1; In event handler, the codes like the following: static void ngx_http_test_timer_hand

nginx timer in log module

2016-09-16 Thread 洪志道
Hi As the following codes. buffer->event->handler = ngx_http_log_flush_handler; static void ngx_http_log_flush_handler(ngx_event_t *ev) { ... if (ev->timedout) { ngx_http_log_flush(ev->data, ev->log); return; } ... } static void ngx_http_log_flush(ngx_open_fil

Re: [PATCH 2 of 2] Core: add ngx_atomic_store() and ngx_atomic_load()

2016-09-16 Thread Piotr Sikora
Hey Maxim, > The "*(lock) == 0" check here is just an optimization, it only > ensures that the lock is likely to succed. Yes, and use of the ngx_atomic_load() doesn't affect that. Namely, in the micro-benchmarks I did (heavy contention - 100 threads trying to acquire lock, update value, release

Re: [PATCH] Use int64 and int32 types with GCC atomics

2016-09-16 Thread Maxim Dounin
Hello! On Fri, Sep 16, 2016 at 02:44:38PM +0100, Alessandro Ghedini wrote: > # HG changeset patch > # User Alessandro Ghedini > # Date 1474033303 -3600 > # Fri Sep 16 14:41:43 2016 +0100 > # Node ID 64afed0e819b9af65e7afa89baad3313f1db18d4 > # Parent e83540f825cd8c936f4f7f1e0336279d6644660

[njs] Returning an intptr_t result by rbtree comparison function

2016-09-16 Thread Igor Sysoev
details: http://hg.nginx.org/njs/rev/28bc6acceb0e branches: changeset: 176:28bc6acceb0e user: Igor Sysoev date: Thu Sep 15 18:00:55 2016 +0300 description: Returning an intptr_t result by rbtree comparison function decreases overhead required to implement correct addresses comparison

[njs] A fix of use-after-free memory bug.

2016-09-16 Thread Igor Sysoev
details: http://hg.nginx.org/njs/rev/70e3b2fc7a8d branches: changeset: 175:70e3b2fc7a8d user: Igor Sysoev date: Thu Sep 15 17:37:52 2016 +0300 description: A fix of use-after-free memory bug. diffstat: njs/njs_vm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diffs (

[nginx] Upstream hash: fixed missing upstream name initialization.

2016-09-16 Thread Vladimir Homutov
details: http://hg.nginx.org/nginx/rev/52367732bcbc branches: changeset: 6697:52367732bcbc user: Vladimir Homutov date: Fri Sep 16 15:13:24 2016 +0300 description: Upstream hash: fixed missing upstream name initialization. diffstat: src/http/modules/ngx_http_upstream_hash_module.c

[PATCH] Use int64 and int32 types with GCC atomics

2016-09-16 Thread Alessandro Ghedini
# HG changeset patch # User Alessandro Ghedini # Date 1474033303 -3600 # Fri Sep 16 14:41:43 2016 +0100 # Node ID 64afed0e819b9af65e7afa89baad3313f1db18d4 # Parent e83540f825cd8c936f4f7f1e0336279d66446606 Use int64 and int32 types with GCC atomics It's not quite clear if this was done on pu

Hook Event After Accept

2016-09-16 Thread Antonio Nappa
Hello, I have a plugin doing the following: - go through active connections and detect the one listening on a particular port (e.g. 443) - register a read event on a different fd that I got with dup(fd of connection on 443) with a custom handler (I don't want to interrupt the normal handshake jus