Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/trunk@20047 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
86089fc893
commit
ff1795cccd
@ -459,24 +459,34 @@ void TBaseServerApp::ProcessCommand(wxString cmd, wxSocketBase& outs)
|
||||
outs << "PONG\n";
|
||||
}
|
||||
|
||||
void TBaseServerApp::OnServerEvent(wxSocketEvent& WXUNUSED(e))
|
||||
void TBaseServerApp::OnServerEvent(wxSocketEvent& e)
|
||||
{
|
||||
// Accept new connection if there is one in the pending
|
||||
// connections queue, else exit. We use Accept(FALSE) for
|
||||
// non-blocking accept (although if we got here, there
|
||||
// should ALWAYS be a pending connection).
|
||||
|
||||
wxSocketBase* sock = m_server->Accept(false);
|
||||
if (sock != NULL)
|
||||
switch(e.GetSocketEvent())
|
||||
{
|
||||
sock->SetEventHandler(*this, SOCKET_ID);
|
||||
sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
|
||||
sock->Notify(true);
|
||||
if (m_bLogVerbose)
|
||||
WriteLog(_("Connection accepted."));
|
||||
case wxSOCKET_CONNECTION:
|
||||
{
|
||||
wxSocketBase* sock = m_server->Accept(false);
|
||||
if (sock != NULL)
|
||||
{
|
||||
sock->SetEventHandler(*this, SOCKET_ID);
|
||||
sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
|
||||
sock->Notify(true);
|
||||
if (m_bLogVerbose)
|
||||
WriteLog(_("Connection accepted."));
|
||||
}
|
||||
else
|
||||
WriteLog(_("Connection REFUSED!"));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
WriteLog(_("Unhandled server event!"));
|
||||
break;
|
||||
}
|
||||
else
|
||||
WriteLog(_("Connection REFUSED!"));
|
||||
}
|
||||
|
||||
struct TCommand : public wxObject
|
||||
@ -516,6 +526,7 @@ void TBaseServerApp::OnSocketEvent(wxSocketEvent& e)
|
||||
case wxSOCKET_LOST:
|
||||
if (m_bLogVerbose)
|
||||
WriteLog("--- Socket lost.");
|
||||
sock->Destroy();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user