Skip to content
Snippets Groups Projects
Commit c0c6a98c authored by Travis Glenn Hansen's avatar Travis Glenn Hansen
Browse files

adding client_limited_count

parent 9833d9d3
No related branches found
No related tags found
No related merge requests found
...@@ -105,6 +105,9 @@ unsigned long long pings_count = 0; ...@@ -105,6 +105,9 @@ unsigned long long pings_count = 0;
//connection/client stats //connection/client stats
unsigned long long clients_count = 0; unsigned long long clients_count = 0;
//over limit count
unsigned long long client_limit_count = 0;
static int daemonize = 0; static int daemonize = 0;
FILE *logfile; FILE *logfile;
...@@ -349,10 +352,16 @@ fs.file-max=100000\n"); ...@@ -349,10 +352,16 @@ fs.file-max=100000\n");
if (client_limit && client_count () >= client_limit) { if (client_limit && client_count () >= client_limit) {
fanout_debug (1, "hit connection limit of: %d\n", client_limit); fanout_debug (1, "hit connection limit of: %d\n", client_limit);
send (client_i->fd, "too many connections\n", send (client_i->fd, "debug!busy\n",
strlen ("too many connections\n"), 0); strlen ("debug!busy\n"), 0);
close (client_i->fd); close (client_i->fd);
free (client_i); free (client_i);
if (client_limit_count == ULLONG_MAX) {
fanout_debug (1, "wow, you've limited alot..\
resetting counter\n");
client_limit_count = 0;
}
client_limit_count++;
continue; continue;
} }
...@@ -719,6 +728,7 @@ resetting counter\n"); ...@@ -719,6 +728,7 @@ resetting counter\n");
asprintf (&message, asprintf (&message,
"uptime: %ldd %ldh %ldm %lds\n\ "uptime: %ldd %ldh %ldm %lds\n\
client-limit: %d\n\ client-limit: %d\n\
limit rejected connections: %llu\n\
rlimits: Soft=%d Hard=%d\n\ rlimits: Soft=%d Hard=%d\n\
max connections: %d\n\ max connections: %d\n\
current connections: %d\n\ current connections: %d\n\
...@@ -734,6 +744,7 @@ total pings: %llu\ ...@@ -734,6 +744,7 @@ total pings: %llu\
\n", uptime/3600/24, uptime/3600%24, \n", uptime/3600/24, uptime/3600%24,
uptime/60%60, uptime%60, uptime/60%60, uptime%60,
client_limit, client_limit,
client_limit_count,
(int) s_rlimit.rlim_cur, (int) s_rlimit.rlim_cur,
(int)s_rlimit.rlim_max, (int)s_rlimit.rlim_max,
max_connection_count, max_connection_count,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment