Commit 05b1ba8b authored by Davis King's avatar Davis King

Set the default max number of connections a server will accept at a

time to 1000 rather than the previous default of infinity.
parent 4c3578dd
...@@ -46,7 +46,7 @@ namespace dlib ...@@ -46,7 +46,7 @@ namespace dlib
thread_count_mutex == a mutex thread_count_mutex == a mutex
thread_count_signaler == a signaler associated with thread_count_mutex thread_count_signaler == a signaler associated with thread_count_mutex
thread_count_zero == a signaler associated with thread_count_mutex thread_count_zero == a signaler associated with thread_count_mutex
max_connections == 0 max_connections == 1000
max_connections_mutex == a mutex for max_connections max_connections_mutex == a mutex for max_connections
CONVENTION CONVENTION
...@@ -217,7 +217,7 @@ namespace dlib ...@@ -217,7 +217,7 @@ namespace dlib
running_signaler(running_mutex), running_signaler(running_mutex),
thread_count(0), thread_count(0),
thread_count_signaler(thread_count_mutex), thread_count_signaler(thread_count_mutex),
max_connections(0), max_connections(1000),
thread_count_zero(thread_count_mutex) thread_count_zero(thread_count_mutex)
{ {
} }
...@@ -285,7 +285,7 @@ namespace dlib ...@@ -285,7 +285,7 @@ namespace dlib
listening_ip_mutex.lock(); listening_ip_mutex.lock();
listening_ip = ""; listening_ip = "";
listening_port = 0; listening_port = 0;
max_connections = 0; max_connections = 1000;
listening_port_mutex.unlock(); listening_port_mutex.unlock();
listening_ip_mutex.unlock(); listening_ip_mutex.unlock();
max_connections_mutex.unlock(); max_connections_mutex.unlock();
...@@ -393,7 +393,7 @@ namespace dlib ...@@ -393,7 +393,7 @@ namespace dlib
listening_ip_mutex.lock(); listening_ip_mutex.lock();
listening_ip = ""; listening_ip = "";
listening_port = 0; listening_port = 0;
max_connections = 0; max_connections = 1000;
listening_port_mutex.unlock(); listening_port_mutex.unlock();
listening_ip_mutex.unlock(); listening_ip_mutex.unlock();
max_connections_mutex.unlock(); max_connections_mutex.unlock();
......
...@@ -21,7 +21,7 @@ namespace dlib ...@@ -21,7 +21,7 @@ namespace dlib
get_listening_ip() == "" get_listening_ip() == ""
get_listening_port() == 0 get_listening_port() == 0
is_running() == false is_running() == false
get_max_connections() == 0 get_max_connections() == 1000
CALLBACK FUNCTIONS CALLBACK FUNCTIONS
...@@ -53,9 +53,10 @@ namespace dlib ...@@ -53,9 +53,10 @@ namespace dlib
Also note that when clear() is called all open connection objects Also note that when clear() is called all open connection objects
will be shutdown(). will be shutdown().
A note about get_max_connections(). When the maximum number of A note about get_max_connections(): when the maximum number of connections
connections has been reached accept() will simply not be called has been reached accept() will simply not be called until the number of
until the number of open connections drops below get_max_connections() open connections drops below get_max_connections(). This means connections
will just wait to be serviced, rather than being outright refused.
THREAD SAFETY THREAD SAFETY
All member functions are thread-safe. All member functions are thread-safe.
...@@ -179,7 +180,7 @@ namespace dlib ...@@ -179,7 +180,7 @@ namespace dlib
/*! /*!
ensures ensures
- returns the maximum number of connections the server will accept - returns the maximum number of connections the server will accept
at a time at a time.
- returns 0 if the server will accept any number of connections - returns 0 if the server will accept any number of connections
throws throws
- std::bad_alloc - std::bad_alloc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment