Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
05b1ba8b
Commit
05b1ba8b
authored
Nov 06, 2012
by
Davis King
Browse files
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
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
9 deletions
+10
-9
dlib/server/server_kernel_1.h
dlib/server/server_kernel_1.h
+4
-4
dlib/server/server_kernel_abstract.h
dlib/server/server_kernel_abstract.h
+6
-5
No files found.
dlib/server/server_kernel_1.h
View file @
05b1ba8b
...
@@ -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
(
100
0
),
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
=
100
0
;
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
=
100
0
;
listening_port_mutex
.
unlock
();
listening_port_mutex
.
unlock
();
listening_ip_mutex
.
unlock
();
listening_ip_mutex
.
unlock
();
max_connections_mutex
.
unlock
();
max_connections_mutex
.
unlock
();
...
...
dlib/server/server_kernel_abstract.h
View file @
05b1ba8b
...
@@ -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() ==
100
0
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment