mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
socket: set fd field to -1 after closing socket
This ensures that g_socket_get_fd() will return -1 after the socket has been closed. https://bugzilla.gnome.org/show_bug.cgi?id=765959
This commit is contained in:
parent
0cd3d5741b
commit
c16a0b53fe
@ -3285,6 +3285,7 @@ g_socket_close (GSocket *socket,
|
||||
break;
|
||||
}
|
||||
|
||||
socket->priv->fd = -1;
|
||||
socket->priv->connected_read = FALSE;
|
||||
socket->priv->connected_write = FALSE;
|
||||
socket->priv->closed = TRUE;
|
||||
|
@ -1197,6 +1197,10 @@ test_fd_reuse (void)
|
||||
g_socket_close (data->server, &error);
|
||||
g_assert_no_error (error);
|
||||
|
||||
g_assert_cmpint (g_socket_get_fd (client), ==, -1);
|
||||
g_assert_cmpint (g_socket_get_fd (client2), ==, -1);
|
||||
g_assert_cmpint (g_socket_get_fd (data->server), ==, -1);
|
||||
|
||||
g_object_unref (data->server);
|
||||
g_object_unref (client);
|
||||
g_object_unref (client2);
|
||||
|
Loading…
Reference in New Issue
Block a user