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:
luca 2009-12-23 09:56:39 +00:00
parent 2dfefb27d4
commit 6ee7801b05
2 changed files with 17 additions and 6 deletions

View File

@ -296,6 +296,7 @@ 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();
if (m_bLogVerbose)
WriteLog(wxString::Format("Sending %lu bytes", nSize)); 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
@ -470,6 +471,7 @@ void TBaseServerApp::OnServerEvent(wxSocketEvent& e)
default : s.Append("Unexpected event!"); break; default : s.Append("Unexpected event!"); break;
} }
if (m_bLogVerbose)
WriteLog(s); WriteLog(s);
// Accept new connection if there is one in the pending // Accept new connection if there is one in the pending
@ -480,6 +482,7 @@ void TBaseServerApp::OnServerEvent(wxSocketEvent& e)
wxSocketBase* sock = m_server->Accept(FALSE); wxSocketBase* sock = m_server->Accept(FALSE);
if (sock) if (sock)
{ {
if (m_bLogVerbose)
WriteLog("--- New client connection accepted"); WriteLog("--- New client connection accepted");
} }
else else
@ -525,6 +528,7 @@ void TBaseServerApp::OnSocketEvent(wxSocketEvent& e)
} }
break; break;
case wxSOCKET_LOST: case wxSOCKET_LOST:
if (m_bLogVerbose)
WriteLog("--- Socket lost."); WriteLog("--- Socket lost.");
break; break;
default: default:

View File

@ -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);
} }