Re: [Libevent-users] Proper socket shutdown.

2010-11-04 Thread Nick Mathewson
On Thu, Nov 4, 2010 at 11:49 AM, Kelly Brock wrote: [...] >        Got the fix.  Fricken IOCP strangness bites again.  You just have to > insert a call to: > >        int err = setsockopt( fd, >                SOL_SOCKET, >                SO_UPDATE_ACCEPT_CONTEXT, >                (char *)&listen

RE: [Libevent-users] Proper socket shutdown.

2010-11-04 Thread Kelly Brock
Hi Nick, > >>       So, I've managed to poke around just a little since sending the > >> example code and not really found anything interesting as of yet but > had > >> an > >> evil thought.  I started wondering about the "shutdown" function being > >> unreliable with IOCP from your information.  

RE: [Libevent-users] Proper socket shutdown.

2010-11-03 Thread Kelly Brock
Hi Nick, > >>       This certainly seems like an evil stupid thing IOCP could be > doing > >> here. :( > > > >        Nope, wasn't this.  Can't even get EOF using the > WSASendDisconnect > > calls, something is definitely wrong at a lower level.  Will dig into it > > more as I find time. > > Were

Re: [Libevent-users] Proper socket shutdown.

2010-11-03 Thread Nick Mathewson
On Wed, Nov 3, 2010 at 8:45 PM, Kelly Brock wrote: > Hi again, > >>       So, I've managed to poke around just a little since sending the >> example code and not really found anything interesting as of yet but had >> an >> evil thought.  I started wondering about the "shutdown" function being >> u

RE: [Libevent-users] Proper socket shutdown.

2010-11-03 Thread Kelly Brock
Hi again, > So, I've managed to poke around just a little since sending the > example code and not really found anything interesting as of yet but had > an > evil thought. I started wondering about the "shutdown" function being > unreliable with IOCP from your information. I can't say for

RE: [Libevent-users] Proper socket shutdown.

2010-11-03 Thread Kelly Brock
Hi Nick, Any luck on this? > > >        Anywhere, here is a quick and dirty testbed for the problem. > > > > > > http://pastebin.com/QF4N2DEw > > > > > >        If you leave "USE_IOCP" set to 0 everything shuts down > correctly. > > > If you turn that flag on though, the EOF's are never s

RE: [Libevent-users] Proper socket shutdown.

2010-10-30 Thread Kelly Brock
Hi, Writing this in between errands. > >        Just a note before the details.  I would suggest adding a little > > section to the manual covering the proper method of handshaked shutdown. > > It's just a minor thing but figuring out the watermark method is non- > obvious > > till you gi

Re: [Libevent-users] Proper socket shutdown.

2010-10-30 Thread Nick Mathewson
On Sat, Oct 30, 2010 at 11:55 AM, Kelly Brock wrote: > Hi Nick, [...] >        Just a note before the details.  I would suggest adding a little > section to the manual covering the proper method of handshaked shutdown. > It's just a minor thing but figuring out the watermark method is non-obvious

Re: [Libevent-users] Proper socket shutdown.

2010-10-30 Thread Nick Mathewson
On Sat, Oct 30, 2010 at 12:03 PM, Ralph Castain wrote: > Just wondering: would it make sense to provide a libevent API for this? Yes, what kind of API did you have in mind? The easiest would be something to implement bufferevent_flush(BEV_FINSISHED) for sockets, and define it to a) write as much

Re: [Libevent-users] Proper socket shutdown.

2010-10-30 Thread Ralph Castain
Just wondering: would it make sense to provide a libevent API for this? I ask because proper shutdown is important to a number of us, and it seems a shame that we all have to independently sprinkle the code throughout our programs wherever sockets are used. On the surface, at least, it would app

RE: [Libevent-users] Proper socket shutdown.

2010-10-30 Thread Kelly Brock
Hi Nick, > > Ok, so figured out a way to do this and it seems clean and works with > the > > select based backend but not the iocp based backend.  Basically I just > set > > > > But, it does not seem to work on the IOCP version which seems a bit odd > > since this should be handled at the OS level

Re: [Libevent-users] Proper socket shutdown.

2010-10-29 Thread Nick Mathewson
On Fri, Oct 29, 2010 at 3:47 PM, Kelly Brock wrote: > Ok, so figured out a way to do this and it seems clean and works with the > select based backend but not the iocp based backend.  Basically I just set > the watermark for write to 1 and 0 and set a flag for "shutting down write". > When I get t

RE: [Libevent-users] Proper socket shutdown.

2010-10-29 Thread Kelly Brock
Ok, so figured out a way to do this and it seems clean and works with the select based backend but not the iocp based backend. Basically I just set the watermark for write to 1 and 0 and set a flag for "shutting down write". When I get the write callback at this point, I just call the shutdown wri