- wxSocketEvent event(m_id);
- wxSocketEventFlags flag = EventToNotify(req_evt);
-
- // fprintf(stderr, "%s: Entering OnRequest (evt %d)\n", (m_type == SOCK_CLIENT)? "client" : "server", req_evt);
-
- // NOTE: this duplicates some of the code in _Wait (lost
- // connection and connection establishment handling) but
- // this doesn't hurt. It has to be here because maybe the
- // WaitXXX are not being used, and it has to be in _Wait
- // as well because the event might be a bit delayed.
- //
- switch(req_evt)
- {
- case wxSOCKET_CONNECTION:
- m_establishing = FALSE;
- m_connected = TRUE;
- break;
- case wxSOCKET_LOST:
- m_defer_buffer = NULL;
- Close();
- break;
- case wxSOCKET_INPUT:
- case wxSOCKET_OUTPUT:
- if (m_defer_buffer)
- {
- // fprintf(stderr, "%s: Habia buffer, evt %d skipped\n", (m_type == SOCK_CLIENT)? "client" : "server", req_evt);
- DoDefer();
- // Do not notify to user
- return;
- }
- break;
- }
-
- // If we are in the middle of a R/W operation, do not
- // propagate events to users.
- if (((req_evt == wxSOCKET_INPUT) && m_reading) ||
- ((req_evt == wxSOCKET_OUTPUT) && m_writing))
- {
- // fprintf(stderr, "%s: Swallowed evt %d\n", (m_type == SOCK_CLIENT)? "client" : "server", req_evt);
- return;
- }
-
- if (((m_neededreq & flag) == flag) && m_notify_state)
- {
- // fprintf(stderr, "%s: Evt %d delivered\n", (m_type == SOCK_CLIENT)? "client" : "server", req_evt);
- event.m_socket = this;
- event.m_skevt = req_evt;
- ProcessEvent(event);
- OldOnNotify(req_evt);
-
- if (m_cbk)
- m_cbk(*this, req_evt, m_cdata);
- }
-
- // fprintf(stderr, "%s: Exiting OnRequest (evt %d)\n", (m_type == SOCK_CLIENT)? "client" : "server", req_evt);