mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01: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 errsv;
|
||||
#ifdef G_OS_WIN32
|
||||
BOOL bool_val;
|
||||
/* See bug #611756 */
|
||||
BOOL bool_val = FALSE;
|
||||
#else
|
||||
int bool_val;
|
||||
#endif
|
||||
@ -388,7 +389,14 @@ g_socket_details_from_fd (GSocket *socket)
|
||||
if (getsockopt (fd, SOL_SOCKET, SO_KEEPALIVE,
|
||||
(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);
|
||||
#endif
|
||||
socket->priv->keepalive = !!bool_val;
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user