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:
guy 2010-02-03 08:38:49 +00:00
parent 86089fc893
commit ff1795cccd

View File

@ -459,13 +459,17 @@ 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).
switch(e.GetSocketEvent())
{
case wxSOCKET_CONNECTION:
{
wxSocketBase* sock = m_server->Accept(false); wxSocketBase* sock = m_server->Accept(false);
if (sock != NULL) if (sock != NULL)
{ {
@ -478,6 +482,12 @@ void TBaseServerApp::OnServerEvent(wxSocketEvent& WXUNUSED(e))
else else
WriteLog(_("Connection REFUSED!")); WriteLog(_("Connection REFUSED!"));
} }
break;
default:
WriteLog(_("Unhandled server event!"));
break;
}
}
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;