Re: [Libevent-users] Send evbuffer to multiple clients

2011-06-07 Thread Joachim Bauch
Am Montag, den 06.06.2011, 20:29 -0400 schrieb Nick Mathewson: > Hm. If there's nothing hideously complex in the source buffer (that > is, nothing added with evbuffer_add_file), you could try an > appropriate combination of evbuffer_peek and evbuffer_add_reference. > Other than that, I'm not think

Re: [Libevent-users] Re: Dead or wrong code

2011-06-07 Thread Nir Soffer
On Jun 7, 2011, at 8:48 PM, Gilad Benjamini wrote: 955 buf->first = chain; 956 if (chain) { 957 chain->misalign += remaining; 958 chain->off -= remaining; 959 } Draining all the buffer trigger this code. Adding an assert in line 957 cause the t

RE: [Libevent-users] Re: Dead or wrong code

2011-06-07 Thread Gilad Benjamini
>> 955 buf->first = chain; >> 956 if (chain) { >> 957 chain->misalign += remaining; >> 958 chain->off -= remaining; >> 959 } > >Draining all the buffer trigger this code. > >Adding an assert in line 957 cause the tests to die, so this code is >certa

Re: [Libevent-users] [PATCH] evbuffer_search_range fails when searching the last byte

2011-06-07 Thread Nir Soffer
On Jun 7, 2011, at 5:01 PM, Andrew W. Nosenko wrote: On Tue, Jun 7, 2011 at 16:30, Nir Soffer wrote: On Jun 7, 2011, at 4:03 AM, Nick Mathewson wrote: On Mon, Jun 6, 2011 at 8:37 PM, Nir Soffer wrote: Here's another patch that might make stuff work. Before I'd apply it, I'd like to ha

Re: [Libevent-users] [PATCH] evbuffer_search_range fails when searching the last byte

2011-06-07 Thread Nir Soffer
On Jun 7, 2011, at 4:03 AM, Nick Mathewson wrote: On Mon, Jun 6, 2011 at 8:37 PM, Nir Soffer wrote: Here's another patch that might make stuff work. Before I'd apply it, I'd like to have a look through everything that's using evbuffer_ptr_set() and evbuffer_ptr right now to make sure that not

Re: [Libevent-users] [PATCH] evbuffer_search_range fails when searching the last byte

2011-06-07 Thread Andrew W. Nosenko
On Tue, Jun 7, 2011 at 16:30, Nir Soffer wrote: > > On Jun 7, 2011, at 4:03 AM, Nick Mathewson wrote: > >> On Mon, Jun 6, 2011 at 8:37 PM, Nir Soffer wrote: >> Here's another patch that might make stuff work.  Before I'd apply it, >> I'd like to have a look through everything that's using >> evbu

[Libevent-users] Re: Dead or wrong code

2011-06-07 Thread Nir Soffer
evbuffer_drain has the code below. Can chain ever be NULL in line 956 ? If the while was completed due to the test in line 935, which dereferenced chain, it can’t. If the while was broken in line 950, then line 949 dereferenced chain, so it can’t be NULL either. I.e. either the test in line

Re: [Libevent-users] [PATCH] evbuffer_search_range fails when searching the last byte

2011-06-07 Thread Nir Soffer
On Jun 7, 2011, at 4:03 AM, Nick Mathewson wrote: On Mon, Jun 6, 2011 at 8:37 PM, Nir Soffer wrote: Here's another patch that might make stuff work. Before I'd apply it, I'd like to have a look through everything that's using evbuffer_ptr_set() and evbuffer_ptr right now to make sure that not

Re: [Libevent-users] [PATCH] evbuffer_search_range fails when searching the last byte

2011-06-07 Thread Nir Soffer
On Jun 7, 2011, at 4:03 AM, Nick Mathewson wrote: On Mon, Jun 6, 2011 at 8:37 PM, Nir Soffer wrote: Hi, I found that evbuffer_search_range fails when you try search the last byte with a non null end pointer. You can work around this by checking the buffer length and calling evbuffer_sear