Patch level :10.0
Files correlati : Ricompilazione Demo : [ ] Commento : aggiunta gestione della verbosità di numerosi tipi di messaggio git-svn-id: svn://10.65.10.50/trunk@19837 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
2dfefb27d4
commit
6ee7801b05
@ -296,7 +296,8 @@ bool TBaseServerApp::CanProcessCommand(wxString& cmd, wxSocketBase& outs)
|
|||||||
void TBaseServerApp::SendContent(wxFileInputStream& inf, wxSocketBase& sock)
|
void TBaseServerApp::SendContent(wxFileInputStream& inf, wxSocketBase& sock)
|
||||||
{
|
{
|
||||||
const size_t nSize = inf.GetSize();
|
const size_t nSize = inf.GetSize();
|
||||||
WriteLog(wxString::Format("Sending %lu bytes", nSize));
|
if (m_bLogVerbose)
|
||||||
|
WriteLog(wxString::Format("Sending %lu bytes", nSize));
|
||||||
|
|
||||||
const size_t BUF_TEMP_SIZE = 1024*1024; // was 1024*16
|
const size_t BUF_TEMP_SIZE = 1024*1024; // was 1024*16
|
||||||
char* buf = new char[BUF_TEMP_SIZE];
|
char* buf = new char[BUF_TEMP_SIZE];
|
||||||
@ -470,7 +471,8 @@ void TBaseServerApp::OnServerEvent(wxSocketEvent& e)
|
|||||||
default : s.Append("Unexpected event!"); break;
|
default : s.Append("Unexpected event!"); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteLog(s);
|
if (m_bLogVerbose)
|
||||||
|
WriteLog(s);
|
||||||
|
|
||||||
// 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
|
||||||
@ -480,7 +482,8 @@ void TBaseServerApp::OnServerEvent(wxSocketEvent& e)
|
|||||||
wxSocketBase* sock = m_server->Accept(FALSE);
|
wxSocketBase* sock = m_server->Accept(FALSE);
|
||||||
if (sock)
|
if (sock)
|
||||||
{
|
{
|
||||||
WriteLog("--- New client connection accepted");
|
if (m_bLogVerbose)
|
||||||
|
WriteLog("--- New client connection accepted");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -525,7 +528,8 @@ void TBaseServerApp::OnSocketEvent(wxSocketEvent& e)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxSOCKET_LOST:
|
case wxSOCKET_LOST:
|
||||||
WriteLog("--- Socket lost.");
|
if (m_bLogVerbose)
|
||||||
|
WriteLog("--- Socket lost.");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -54,7 +54,6 @@ protected:
|
|||||||
void CreateServersList(wxArrayString& arr) const;
|
void CreateServersList(wxArrayString& arr) const;
|
||||||
bool PingProcess(const wxString& strApp);
|
bool PingProcess(const wxString& strApp);
|
||||||
void StopProcess(const wxString& strApp);
|
void StopProcess(const wxString& strApp);
|
||||||
void KillProcess(const wxString& strApp);
|
|
||||||
wxString StartProcess(const wxString& strApp);
|
wxString StartProcess(const wxString& strApp);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -131,7 +130,15 @@ void TLurchServer::OnTimer(wxTimerEvent& WXUNUSED(evt))
|
|||||||
if (!PingProcess(strApp))
|
if (!PingProcess(strApp))
|
||||||
{
|
{
|
||||||
TProcess* pProcess = (TProcess*)m_ProcMap[strApp];
|
TProcess* pProcess = (TProcess*)m_ProcMap[strApp];
|
||||||
pProcess->Kill(pProcess->GetPid());
|
wxKillError ke = pProcess->Kill(pProcess->GetPid());
|
||||||
|
if (ke == wxKILL_OK)
|
||||||
|
WriteLog(strApp + " killed!");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxString strMsg;
|
||||||
|
strMsg << "Error " << ke << " killing " << strApp;
|
||||||
|
WriteLog(strMsg);
|
||||||
|
}
|
||||||
wxSleep(2);
|
wxSleep(2);
|
||||||
StartProcess(strApp);
|
StartProcess(strApp);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user