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";
|
outs << "PONG\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void TBaseServerApp::OnServerEvent(wxSocketEvent& WXUNUSED(e))
|
void TBaseServerApp::OnServerEvent(wxSocketEvent& e)
|
||||||
{
|
{
|
||||||
// Accept new connection if there is one in the pending
|
// Accept new connection if there is one in the pending
|
||||||
// connections queue, else exit. We use Accept(FALSE) for
|
// connections queue, else exit. We use Accept(FALSE) for
|
||||||
// non-blocking accept (although if we got here, there
|
// non-blocking accept (although if we got here, there
|
||||||
// should ALWAYS be a pending connection).
|
// should ALWAYS be a pending connection).
|
||||||
|
|
||||||
wxSocketBase* sock = m_server->Accept(false);
|
switch(e.GetSocketEvent())
|
||||||
if (sock != NULL)
|
|
||||||
{
|
{
|
||||||
sock->SetEventHandler(*this, SOCKET_ID);
|
case wxSOCKET_CONNECTION:
|
||||||
sock->SetNotify(wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
|
{
|
||||||
sock->Notify(true);
|
wxSocketBase* sock = m_server->Accept(false);
|
||||||
if (m_bLogVerbose)
|
if (sock != NULL)
|
||||||
WriteLog(_("Connection accepted."));
|
{
|
||||||
|
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
|
struct TCommand : public wxObject
|
||||||
@ -516,6 +526,7 @@ void TBaseServerApp::OnSocketEvent(wxSocketEvent& e)
|
|||||||
case wxSOCKET_LOST:
|
case wxSOCKET_LOST:
|
||||||
if (m_bLogVerbose)
|
if (m_bLogVerbose)
|
||||||
WriteLog("--- Socket lost.");
|
WriteLog("--- Socket lost.");
|
||||||
|
sock->Destroy();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user