diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-05-25 09:18:52 +0200 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-05-25 09:18:52 +0200 |
commit | a4a418a679f1ac760a8763edd856f0178cfc6dde (patch) | |
tree | 85300ca3a2b3a942998a0c864ae90894857ebf5f /source/cWebAdmin.cpp | |
parent | Fixed output directory structure in the "Release profiled" configuration (diff) | |
download | cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.gz cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.bz2 cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.lz cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.xz cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.tar.zst cuberite-a4a418a679f1ac760a8763edd856f0178cfc6dde.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cWebAdmin.cpp | 23 |
1 files changed, 9 insertions, 14 deletions
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<char> 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;
}
|