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

memory leaks

parent 1d437035
No related branches found
No related tags found
No related merge requests found
...@@ -118,6 +118,7 @@ struct client *client_head = NULL; ...@@ -118,6 +118,7 @@ struct client *client_head = NULL;
struct subscription *subscription_head = NULL; struct subscription *subscription_head = NULL;
struct channel *channel_head = NULL; struct channel *channel_head = NULL;
struct rlimit s_rlimit;
int main (int argc, char *argv[]) int main (int argc, char *argv[])
...@@ -135,7 +136,6 @@ int main (int argc, char *argv[]) ...@@ -135,7 +136,6 @@ int main (int argc, char *argv[])
socklen_t clilen; socklen_t clilen;
struct sockaddr_in serv_addr, cli_addr; struct sockaddr_in serv_addr, cli_addr;
struct rlimit s_rlimit;
static struct option long_options[] = { static struct option long_options[] = {
{"port", 1, 0, 0}, {"port", 1, 0, 0},
...@@ -311,6 +311,7 @@ fs.file-max=100000\n"); ...@@ -311,6 +311,7 @@ fs.file-max=100000\n");
fanout_debug (1, "rlimit set at: Soft=%d Hard=%d\n", s_rlimit.rlim_cur, s_rlimit.rlim_max); fanout_debug (1, "rlimit set at: Soft=%d Hard=%d\n", s_rlimit.rlim_cur, s_rlimit.rlim_max);
fanout_debug (2, "max client connections: %d\n", client_limit); fanout_debug (2, "max client connections: %d\n", client_limit);
fanout_debug (2, "FD_SETSIZE: %d\n", FD_SETSIZE);
while (1) { while (1) {
fanout_debug (3, "server waiting for new activity\n"); fanout_debug (3, "server waiting for new activity\n");
...@@ -341,6 +342,7 @@ fs.file-max=100000\n"); ...@@ -341,6 +342,7 @@ fs.file-max=100000\n");
if ((client_i->fd = accept (srvsock, (struct sockaddr *)&cli_addr, if ((client_i->fd = accept (srvsock, (struct sockaddr *)&cli_addr,
&clilen)) == -1) { &clilen)) == -1) {
fanout_debug (0, "%s\n", strerror (errno)); fanout_debug (0, "%s\n", strerror (errno));
free (client_i);
fanout_error ("failed on accept ()"); fanout_error ("failed on accept ()");
continue; continue;
} }
...@@ -350,6 +352,7 @@ fs.file-max=100000\n"); ...@@ -350,6 +352,7 @@ fs.file-max=100000\n");
send (client_i->fd, "too many connections\n", send (client_i->fd, "too many connections\n",
strlen ("too many connections\n"), 0); strlen ("too many connections\n"), 0);
close (client_i->fd); close (client_i->fd);
free (client_i);
continue; continue;
} }
...@@ -715,6 +718,8 @@ resetting counter\n"); ...@@ -715,6 +718,8 @@ resetting counter\n");
asprintf (&message, asprintf (&message,
"uptime: %ldd %ldh %ldm %lds\n\ "uptime: %ldd %ldh %ldm %lds\n\
client-limit: %d\n\
rlimits: Soft=%d Hard=%d\n\
max connections: %d\n\ max connections: %d\n\
current connections: %d\n\ current connections: %d\n\
current channels: %d\n\ current channels: %d\n\
...@@ -728,6 +733,9 @@ total unsubscribes: %llu\n\ ...@@ -728,6 +733,9 @@ total unsubscribes: %llu\n\
total pings: %llu\ 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,
(int) s_rlimit.rlim_cur,
(int)s_rlimit.rlim_max,
max_connection_count, max_connection_count,
current_client_count, current_channel_count, current_client_count, current_channel_count,
current_subscription_count, current_subscription_count,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment