+ bool ret;
+
+ if (m_connected) // Already connected
+ return TRUE;
+
+ if (!m_establishing) // No connection in progress
+ return FALSE;
+
+ ret = _Wait(seconds, milliseconds, GSOCK_CONNECTION_FLAG | GSOCK_LOST_FLAG);
+
+ // GRG: m_connected and m_establishing will be updated in
+ // OnRequest(), but we do it here anyway because sometimes
+ // the event might be a bit delayed, and if that happens,
+ // when WaitOnConnect() returns, m_connected will still be
+ // FALSE. We have to do it as well in OnRequest because
+ // maybe WaitOnConnect() is not being used...