Re: [Libevent-users] Recommended way of notifying all active sessions

2012-08-10 Thread Nick Mathewson
On Fri, Aug 10, 2012 at 11:42 AM, Chernyshev Vyacheslav wrote: > Hello. I bet that this question was already asked a couple of times, but… > What is the right way to execute some action for all currently registered > descriptors? Let imagine that I have a lot of active client sessions that > mu

[Libevent-users] Recommended way of notifying all active sessions

2012-08-10 Thread Chernyshev Vyacheslav
Hello. I bet that this question was already asked a couple of times, but… What is the right way to execute some action for all currently registered descriptors? Let imagine that I have a lot of active client sessions that must save some state to DB when socket is closed and that I use buffered e

Re: [Libevent-users] How to read data coming from a POST request

2012-08-10 Thread Riccardo Tacconi
Thank you (Dave too). I started to fear that malloc was not called inside. As you might guess I am a C noob, well re-learning C or trying to learnt it properly. Now I can see the parameters passed from the user agent. On 10 August 2012 17:21, Chernyshev Vyacheslav wrote: > > 10.08.2012, в 19:15

Re: [Libevent-users] how to handle SIGCHLD before going into dispatch

2012-08-10 Thread Yee Keat Phuah
Hi Dave, On Fri, Aug 10, 2012 at 11:12 PM, Dave Hart wrote: > Your code has a race between the child and the parent. If you create > the base and install the SIGCHLD handling before forking, the race > will be cured. Thanks! That worked, I thought it was better to create the base in the parent

Re: [Libevent-users] How to read data coming from a POST request

2012-08-10 Thread Chernyshev Vyacheslav
10.08.2012, в 19:15, Riccardo Tacconi wrote > char *data; > evbuffer_copyout(in_evb, data, len); Hello. You must have an initialized data buffer before copying anything to it. Something like: char *data = malloc(len); With your current code you try to write to memory that does not belon

Re: [Libevent-users] How to read data coming from a POST request

2012-08-10 Thread Dave Hart
On Fri, Aug 10, 2012 at 15:11 UTC, Riccardo Tacconi wrote: > void servlet(struct evhttp_request *req, struct evbuffer *evb) { > size_t len = evbuffer_get_length(evhttp_request_get_input_buffer(req)); > struct evbuffer *in_evb = evhttp_request_get_input_buffer(req); > char *data; > e

Re: [Libevent-users] how to handle SIGCHLD before going into dispatch

2012-08-10 Thread Dave Hart
Hi Yee, Your code has a race between the child and the parent. If you create the base and install the SIGCHLD handling before forking, the race will be cured. Cheers, Dave Hart *** To unsubscribe, send an e-mail to majord...@fre

[Libevent-users] how to handle SIGCHLD before going into dispatch

2012-08-10 Thread Yee Keat Phuah
I have a piece of code that does a fork, and the parent goes into the event_dispatch loop while the child does something. The child will exit at some point of time so I will need to attach a SIGCHLD handler into the event_base (I assume that I shouldn't be calling event_base_loopexit from a standar