server: remove connection limit from tcl and telnet servers

Add constant CONNECTION_LIMIT_UNLIMITED which indicates a service
has no connection limit

Change-Id: I008d31264010c25fa44ca74eb6d5740eca38bee1
Signed-off-by: Austin Morton <austinpmorton@gmail.com>
Reviewed-on: http://openocd.zylin.com/2937
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
This commit is contained in:
Austin Morton
2015-08-13 14:45:29 -04:00
committed by Paul Fertser
parent d28ab08cfa
commit 8bffcc0cd4
4 changed files with 10 additions and 5 deletions

View File

@@ -145,7 +145,8 @@ static int add_connection(struct service *service, struct command_context *cmd_c
;
*p = c;
service->max_connections--;
if (service->max_connections != CONNECTION_LIMIT_UNLIMITED)
service->max_connections--;
return ERROR_OK;
}
@@ -172,7 +173,9 @@ static int remove_connection(struct service *service, struct connection *connect
*p = c->next;
free(c);
service->max_connections++;
if (service->max_connections != CONNECTION_LIMIT_UNLIMITED)
service->max_connections++;
break;
}
@@ -446,7 +449,7 @@ int server_loop(struct command_context *command_context)
/* handle new connections on listeners */
if ((service->fd != -1)
&& (FD_ISSET(service->fd, &read_fds))) {
if (service->max_connections > 0)
if (service->max_connections != 0)
add_connection(service, command_context);
else {
if (service->type == CONNECTION_TCP) {