From a4a418a679f1ac760a8763edd856f0178cfc6dde Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 25 May 2012 07:18:52 +0000 Subject: Merged the composable_generator branch into the trunk git-svn-id: http://mc-server.googlecode.com/svn/trunk@504 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cWebAdmin.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'source/cWebAdmin.cpp') diff --git a/source/cWebAdmin.cpp b/source/cWebAdmin.cpp index 57aea3146..d9a89b961 100644 --- a/source/cWebAdmin.cpp +++ b/source/cWebAdmin.cpp @@ -310,6 +310,10 @@ bool cWebAdmin::Init( int a_Port ) return true; } + + + + #ifdef _WIN32 DWORD WINAPI cWebAdmin::ListenThread(LPVOID lpParam) #else @@ -319,7 +323,10 @@ void *cWebAdmin::ListenThread( void *lpParam ) cWebAdmin* self = (cWebAdmin*)lpParam; self->m_WebServer = new webserver(self->m_Port, Request_Handler ); - self->m_WebServer->Begin(); + if (!self->m_WebServer->Begin()) + { + LOGWARN("WebServer failed to start! WebAdmin is disabled"); + } self->m_Event->Set(); return 0; @@ -341,20 +348,8 @@ std::string cWebAdmin::GetTemplate() return ""; } - // obtain file size: - int lSize = f.GetSize(); - - // allocate memory to contain the whole file: - std::auto_ptr buffer(new char[lSize]); // auto_ptr deletes the memory in its destructor - // copy the file into the buffer: - if (f.Read(buffer.get(), lSize) != lSize) - { - LOG ("WEBADMIN: Could not read file \"%s\"", SourceFile); - return ""; - } - - retVal.assign(buffer.get(), lSize ); + f.ReadRestOfFile(retVal); return retVal; } -- cgit v1.2.3