[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Proper socket shutdown.



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 appear that a simple API could take care of this for us.


On Oct 30, 2010, at 9:55 AM, Kelly Brock wrote:

> 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 and automatically dealt
>> with.
>>> I'm fairly confident of the test code given it starts and stops
>> event_base
>>> 10 times, runs 1024 sockets through the connection, send/recv and
>> shutdown
>>> all without errors.
>>> 
>>> I'll see if I can figure out the problem but it's been a while since I
>> poked
>>> the hornet's net which is IOCP...
>> 
>> Hi, Kelly, and thanks for checking that out.
> 
> 	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 give it some further thought.  (Well, it was to me at the time,
> then again it was 2am. :))
> 
> 	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 seen.  I just got this
> test case functional so forgive the dirty leaky implementation if you will,
> but please do check that I'm not just making some other stupid error as I'm
> still getting used to 2.0 changes.  I'm sure there are other problems beyond
> the test case in this code; I put it together relatively quickly by
> extracting bits and pieces out of my C++ wrappers/abstraction.
> 
>> If you don't find the bug (or if you don't find a fix for the bug)
>> right away, could you please post some test code to help reproduce and
>> demonstrate it, either here or on the bugtracker?  (Send a link if
>> it's long.)  This is the kind of thing we should get fixed in 2.0 if
>> possible.
> 
> 	I just got this functional so haven't started debugging.  If I
> happen to find it in the next 30 minutes before I run out will post a fix,
> if not I will be unlikely to get back to this till later tonight.
> 
> KB
> 
> 
> ***********************************************************************
> To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
> unsubscribe libevent-users    in the body.

***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.