* net.cc (cygwin_getsockopt): Rearrange code slightly and handle
TCP_NODELAY just like SO_KEEPALIVE and SO_DONTROUTE.
This commit is contained in:
parent
7e9b678464
commit
67797a9560
|
@ -1,3 +1,8 @@
|
||||||
|
2014-05-05 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* net.cc (cygwin_getsockopt): Rearrange code slightly and handle
|
||||||
|
TCP_NODELAY just like SO_KEEPALIVE and SO_DONTROUTE.
|
||||||
|
|
||||||
2014-05-03 Christopher Faylor <me.cygwin2014@cgf.cx>
|
2014-05-03 Christopher Faylor <me.cygwin2014@cgf.cx>
|
||||||
|
|
||||||
* spawn.cc (av::setup): Eat trailing whitespace on #! script.
|
* spawn.cc (av::setup): Eat trailing whitespace on #! script.
|
||||||
|
|
|
@ -923,33 +923,28 @@ cygwin_getsockopt (int fd, int level, int optname, void *optval,
|
||||||
(int *) optlen);
|
(int *) optlen);
|
||||||
if (res == SOCKET_ERROR)
|
if (res == SOCKET_ERROR)
|
||||||
set_winsock_errno ();
|
set_winsock_errno ();
|
||||||
else if (level == SOL_SOCKET)
|
else if (level == SOL_SOCKET && optname == SO_ERROR)
|
||||||
{
|
|
||||||
switch (optname)
|
|
||||||
{
|
|
||||||
case SO_ERROR:
|
|
||||||
{
|
{
|
||||||
int *e = (int *) optval;
|
int *e = (int *) optval;
|
||||||
debug_printf ("WinSock SO_ERROR = %d", *e);
|
debug_printf ("WinSock SO_ERROR = %d", *e);
|
||||||
*e = find_winsock_errno (*e);
|
*e = find_winsock_errno (*e);
|
||||||
}
|
}
|
||||||
break;
|
else if (*optlen == 1)
|
||||||
case SO_KEEPALIVE:
|
{
|
||||||
case SO_DONTROUTE:
|
/* Regression in Vista and later: instead of a 4 byte BOOL value,
|
||||||
/* Regression in Vista and later: instead of a 4 byte BOOL
|
a 1 byte BOOLEAN value is returned, in contrast to older systems
|
||||||
value, a 1 byte BOOLEAN value is returned, in contrast
|
and the documentation. Since an int type is expected by the
|
||||||
to older systems and the documentation. Since an int
|
calling application, we convert the result here. For some reason
|
||||||
type is expected by the calling application, we convert
|
only three BSD-compatible socket options seem to be affected. */
|
||||||
the result here. */
|
if ((level == SOL_SOCKET
|
||||||
if (*optlen == 1)
|
&& (optname == SO_KEEPALIVE || optname == SO_DONTROUTE))
|
||||||
|
|| (level == IPPROTO_TCP && optname == TCP_NODELAY))
|
||||||
{
|
{
|
||||||
BOOLEAN *in = (BOOLEAN *) optval;
|
BOOLEAN *in = (BOOLEAN *) optval;
|
||||||
int *out = (int *) optval;
|
int *out = (int *) optval;
|
||||||
*out = *in;
|
*out = *in;
|
||||||
*optlen = 4;
|
*optlen = 4;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,3 +34,8 @@ Bug Fixes
|
||||||
when calling select on a dup'ed socket after an asynchronous connection
|
when calling select on a dup'ed socket after an asynchronous connection
|
||||||
attempt.
|
attempt.
|
||||||
Fixes: http://cygwin.com/ml/cygwin/2014-04/msg00510.html
|
Fixes: http://cygwin.com/ml/cygwin/2014-04/msg00510.html
|
||||||
|
|
||||||
|
- Workaround the problem that getsockopt(IPPROTO_TCP,TCP_NODELAY) returns
|
||||||
|
the option value as a 1 byte value, while BSD and Linux expect a 4 byte
|
||||||
|
value.
|
||||||
|
Fixes: http://cygwin.com/ml/cygwin/2014-04/msg00624.html
|
||||||
|
|
Loading…
Reference in New Issue