mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-01 05:13:06 +02:00
The SO_KEEPALIVE value seems to actually be a char on Windows
Do still use a BOOL variable, but initialize it to FALSE before the getsockopt(), and drop the assertion on Windows. Should fix bug
This commit is contained in:
parent
1caaa4f591
commit
a57522deae
@ -305,7 +305,8 @@ g_socket_details_from_fd (GSocket *socket)
|
|||||||
int value;
|
int value;
|
||||||
int errsv;
|
int errsv;
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
BOOL bool_val;
|
/* See bug #611756 */
|
||||||
|
BOOL bool_val = FALSE;
|
||||||
#else
|
#else
|
||||||
int bool_val;
|
int bool_val;
|
||||||
#endif
|
#endif
|
||||||
@ -388,7 +389,14 @@ g_socket_details_from_fd (GSocket *socket)
|
|||||||
if (getsockopt (fd, SOL_SOCKET, SO_KEEPALIVE,
|
if (getsockopt (fd, SOL_SOCKET, SO_KEEPALIVE,
|
||||||
(void *)&bool_val, &optlen) == 0)
|
(void *)&bool_val, &optlen) == 0)
|
||||||
{
|
{
|
||||||
|
#ifndef G_OS_WIN32
|
||||||
|
/* Experimentation indicates that the SO_KEEPALIVE value is
|
||||||
|
* actually a char on Windows, even if documentation claims it
|
||||||
|
* to be a BOOL which is a typedef for int. So this g_assert()
|
||||||
|
* fails. See bug #611756.
|
||||||
|
*/
|
||||||
g_assert (optlen == sizeof bool_val);
|
g_assert (optlen == sizeof bool_val);
|
||||||
|
#endif
|
||||||
socket->priv->keepalive = !!bool_val;
|
socket->priv->keepalive = !!bool_val;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user