libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] winsock & EPOLL_TURBO


From: LRN
Subject: Re: [libmicrohttpd] winsock & EPOLL_TURBO
Date: Sat, 10 Aug 2013 20:49:03 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Thunderbird/25.0a1

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10.08.2013 19:54, Christian Grothoff wrote:
> On 08/10/13 17:50, LRN wrote:
>> I've made a patch that fixes the problem, no need to disable shutdown()
>> completely. Here it is.
>>
>> The problem is that winsock freaks out (and prevents you from sending
>> the reply) if you shutdown with SD_RECEIVE while there is data in recv
>> buffer.
>>
>> Sorry, couldn't send the patch sooner - had to reproduce the problem in
>> a testcase, then test the patch in MHD.
> 
> I'm not sure that patch _always_ works.  There is a natural race 
> condition in that code, as more data can always be received just between 
> your recvfrom call and the shutdown call.

Yeah, i've modified my testcase, and indeed, if i let the client send
more data after i've purged the buffer, the old buggy send() behaviour
returns. Setting recv buffer size to 0 doesn't prevent it.

The winsocky way (also kind of documented in MSDN) to handle this is to
send the reply BEFORE shutting down, and THEN shut down.

- -- 
O< ascii ribbon - stop html email! - www.asciiribbon.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)

iQEcBAEBAgAGBQJSBm78AAoJEOs4Jb6SI2Cw4UsH+gIdPqJFR8aLOk3aHCHuGbXV
wreoXUnonniXOXrSQU/mt0UOczFdITTNxuUysm4jagfdMBhe8Xlqu/K+jBUBLlGg
8HsjhIkGl0Fl+hcXHJiPGSQpB7cloLRtmYiLp3QZZXfN3U/Jp6IhAosug/w4YvL9
7MInf8E5ry9FjvRp1hI7MfWKffSmBNbOZ5Ek8YxN8C3HP5Ac16pGO5d6i8W9LJbY
oAYRyJqSFfXteA1Iz8dxx2qKt/I7pdnEWTHXATgX8mQqRjzL1OzJk5ymeGmxXchu
CieDeRWgpp3W4DI7Iu/RdxfM1kPfOsa5gP6/uDZtdFXHC8cwjYjZsmImFOjdzMo=
=tZwq
-----END PGP SIGNATURE-----



reply via email to

[Prev in Thread] Current Thread [Next in Thread]