Fix possible crashs when using server class
This commit is contained in:
parent
5344a179a4
commit
b52c52cd36
|
@ -31,7 +31,7 @@ class OutputMessage : public LuaObject
|
|||
{
|
||||
public:
|
||||
enum {
|
||||
BUFFER_MAXSIZE = 1024,
|
||||
BUFFER_MAXSIZE = 65536,
|
||||
MAX_STRING_LENGTH = 65536,
|
||||
MAX_HEADER_SIZE = 8
|
||||
};
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue