- if ( !socket->HasAnyEnabledCallbacks() )
- dispatcher->UnregisterFD(fd);
- else
- dispatcher->ModifyFD(fd, socket, socket->GetEnabledCallbacks());
+wxFDIOManager::Direction
+wxSocketFDBasedManager::GetDirForEvent(wxSocketImpl *socket,
+ wxSocketNotify event)
+{
+ switch ( event )
+ {
+ default:
+ wxFAIL_MSG( "unknown socket event" );
+ return wxFDIOManager::INPUT; // we must return something
+
+ case wxSOCKET_LOST:
+ wxFAIL_MSG( "unexpected socket event" );
+ return wxFDIOManager::INPUT; // as above
+
+ case wxSOCKET_INPUT:
+ return wxFDIOManager::INPUT;
+
+ case wxSOCKET_OUTPUT:
+ return wxFDIOManager::OUTPUT;
+
+ case wxSOCKET_CONNECTION:
+ // for server sockets we're interested in events indicating
+ // that a new connection is pending, i.e. that accept() will
+ // succeed and this is indicated by socket becoming ready for
+ // reading, while for the other ones we're interested in the
+ // completion of non-blocking connect() which is indicated by
+ // the socket becoming ready for writing
+ return socket->IsServer() ? wxFDIOManager::INPUT
+ : wxFDIOManager::OUTPUT;
+ }