- handler->RemoveFlag(flag);
-
- if ( !handler->GetFlags() )
- {
- dispatcher->UnregisterFD(fd);
- delete handler;
- socket->m_handler = NULL;
- }
- else
- {
- dispatcher->ModifyFD(fd, handler, handler->GetFlags());
- }
- }
- else
- {
- dispatcher->UnregisterFD(fd);
+ 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;