[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [Libevent-users] Proper socket shutdown.
- To: libevent-users@xxxxxxxxxxxxx
- Subject: Re: [Libevent-users] Proper socket shutdown.
- From: Ralph Castain <rhc@xxxxxxxxxxxx>
- Date: Sat, 30 Oct 2010 10:03:27 -0600
- Delivered-to: archiver@xxxxxxxx
- Delivered-to: libevent-users-outgoing@xxxxxxxx
- Delivered-to: libevent-users@xxxxxxxx
- Delivery-date: Sat, 30 Oct 2010 12:03:39 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:content-type :mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=gbJn5aGL+Uyhvt9A67onQBUzum948qho6795VpksMI4=; b=N2RMe2hKx8nUpkr7vtS3peB9TZ6XXTXYzaJq6ZWJl3WP9rtGzz6lnTuqBgBhxe+/ra G7hq7op1SGKNsvt+XDMRs0lb1kn7/Za5prn8rLeRqaKbmxLJhwnpmgK03OhTgllT8xMH eM2CDVN3clbzpCNLReX5awZC9Gb6xKkPtVXjI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=lodWdaGNyzQl+EYBF/b01uh2nxSTnq1ol4C9q/t+O+LbT9moclN4RJ9NLjVKr7Hk1X 5ICN/yA8YnRODyIj96uQizFWJdIZdcyIoCviHQdgkAhN+LTp/ZDp31CyNg6Z33G5OfUp 4F6iFOYJux7/DCk5bB0LwO3yUAjkMhjJkhCpk=
- In-reply-to: <8DC2824322CD4F8FA9025040CECBBE66@Office>
- References: <8DC2824322CD4F8FA9025040CECBBE66@Office>
- Reply-to: libevent-users@xxxxxxxxxxxxx
- Sender: owner-libevent-users@xxxxxxxxxxxxx
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.