mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
added server error exception system; moved host and message size validation into server, references #7, sessions now have a pointer back to the server so they can ask it about server wide policy.
This commit is contained in:
@@ -39,7 +39,9 @@ int main(int argc, char* argv[]) {
|
||||
short port = 5000;
|
||||
|
||||
if (argc == 3) {
|
||||
// TODO: input validation?
|
||||
port = atoi(argv[2]);
|
||||
|
||||
|
||||
std::stringstream temp;
|
||||
temp << argv[1] << ":" << port;
|
||||
@@ -57,6 +59,17 @@ int main(int argc, char* argv[]) {
|
||||
new websocketpp::server(io_service,endpoint,host,chat_handler)
|
||||
);
|
||||
|
||||
// setup server settings
|
||||
server->add_host(host);
|
||||
|
||||
// Chat server should only be receiving small text messages, reduce max
|
||||
// message size limit slightly to save memory, improve performance, and
|
||||
// guard against DoS attacks.
|
||||
server->set_max_message_size(0xFFFF); // 64KiB
|
||||
|
||||
// start the server
|
||||
server->start_accept();
|
||||
|
||||
std::cout << "Starting chat server on " << host << std::endl;
|
||||
|
||||
io_service.run();
|
||||
|
||||
Reference in New Issue
Block a user