Fix possible crashs when using server class

This commit is contained in:
Eduardo Bart 2013-01-08 18:05:24 -02:00
parent 5344a179a4
commit b52c52cd36
2 changed files with 9 additions and 2 deletions

View File

@ -31,7 +31,7 @@ class OutputMessage : public LuaObject
{
public:
enum {
BUFFER_MAXSIZE = 1024,
BUFFER_MAXSIZE = 65536,
MAX_STRING_LENGTH = 65536,
MAX_HEADER_SIZE = 8
};

View File

@ -32,7 +32,14 @@ Server::Server(int port)
ServerPtr Server::create(int port)
{
return ServerPtr(new Server(port));
try {
Server *server = new Server(port);
return ServerPtr(server);
}
catch(const std::exception& e) {
g_logger.error(stdext::format("Failed to initialize server: %s", e.what()));
return ServerPtr();
}
}
void Server::close()