{
assert(socket != NULL);
+ /* When using CFSocket we MUST invalidate before closing the fd */
+#ifdef __DARWIN__
+ /* Per-socket GUI-specific cleanup */
+ _GSocket_GUI_Destroy_Socket(socket);
+#endif
+
/* Check that the socket is really shutdowned */
if (socket->m_fd != INVALID_SOCKET)
GSocket_Shutdown(socket);
+#ifndef __DARWIN__
/* Per-socket GUI-specific cleanup */
_GSocket_GUI_Destroy_Socket(socket);
+#endif
/* Destroy private addresses */
if (socket->m_local)
assert(socket != NULL);
+ /* When using CFSocket we MUST NOT reenable events until we finish reading */
+#ifndef __DARWIN__
/* Reenable INPUT events */
_GSocket_Enable(socket, GSOCK_INPUT);
+#endif
if (socket->m_fd == INVALID_SOCKET || socket->m_server)
{
socket->m_error = GSOCK_IOERR;
}
+#ifdef __DARWIN__
+ /* Reenable INPUT events */
+ _GSocket_Enable(socket, GSOCK_INPUT);
+#endif
+
return ret;
}