From 0d34c30e5535d496c2b08bea971a8abb4a1b34da Mon Sep 17 00:00:00 2001 From: Kevin Hock Date: Mon, 19 Sep 2005 14:56:50 +0000 Subject: [PATCH] Make sure Enable_Events is called when a connection is immediately established (such as when using domain sockets for IPC). Fixes bug 1195700 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35595 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/unix/gsocket.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/unix/gsocket.cpp b/src/unix/gsocket.cpp index cef26902b3..862e94c989 100644 --- a/src/unix/gsocket.cpp +++ b/src/unix/gsocket.cpp @@ -716,9 +716,14 @@ GSocketError GSocket::Connect(GSocketStream stream) /* Connect it to the peer address, with a timeout (see below) */ ret = connect(m_fd, m_peer->m_addr, m_peer->m_len); - /* We only call Enable_Events if we know e aren't shutting down the socket */ - - if (m_non_blocking) + /* We only call Enable_Events if we know we aren't shutting down the socket. + * NB: Enable_Events needs to be called whether the socket is blocking or + * non-blocking, it just shouldn't be called prior to knowing there is a + * connection _if_ blocking sockets are being used. + * If connect above returns 0, we are already connected and need to make the + * call to Enable_Events now. + + if (m_non_blocking || ret == 0) { gs_gui_functions->Enable_Events(this); } -- 2.47.2