virtual void Close() = 0;
virtual void Shutdown();
+ // notify m_wxsocket about the given socket event by calling its (inaptly
+ // named) OnRequest() method
+ void NotifyOnStateChange(GSocketEvent event);
+
// this is officially SOCKET (unsigned int) under Windows but we don't want
// to include winsock.h which defines SOCKET from here so just use int
// under all platforms
protected:
GSocketBase(wxSocketBase& wxsocket);
- // notify m_wxsocket
- void NotifyOnStateChange(GSocketEvent event);
-
private:
// set in ctor and never changed except that it's reset to NULL when the
// socket is shut down
if (event != -1)
{
- cback = socket->m_cbacks[event];
- data = socket->m_data[event];
-
if (event == GSOCK_LOST)
socket->m_detected = GSOCK_LOST_FLAG;
else
}
}
- /* OK, we can now leave the critical section because we have
- * already obtained the callback address (we make no further
- * accesses to socket->whatever). However, the app should
- * be prepared to handle events from a socket that has just
- * been closed!
- */
LeaveCriticalSection(&critical);
- if (cback != NULL)
- (cback)(socket, event, data);
+ if ( socket )
+ socket->NotifyOnStateChange(event);
return (LRESULT) 0;
}