diff options
author | drath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2006-06-25 21:02:44 +0000 |
---|---|---|
committer | drath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2006-06-25 21:02:44 +0000 |
commit | 1960973baf8022b4525e3ac94aed8dace7f9b478 (patch) | |
tree | 4afcaf8280f41d903007c1ceef5f244477bba3d2 /src/server | |
parent | d4d36b0a9a778caec77fb8e4ce5b1e406d5a8f50 (diff) | |
download | riscv-openocd-1960973baf8022b4525e3ac94aed8dace7f9b478.zip riscv-openocd-1960973baf8022b4525e3ac94aed8dace7f9b478.tar.gz riscv-openocd-1960973baf8022b4525e3ac94aed8dace7f9b478.tar.bz2 |
- fixed bug in Thumb sw breakpoint handling (thanks to Spen for this patch)
- fixed handling of services linked list (thanks to Spen for this patch)
git-svn-id: svn://svn.berlios.de/openocd/trunk@76 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/server.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/src/server/server.c b/src/server/server.c index a034da7..628c492 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -86,19 +86,16 @@ int add_connection(service_t *service, command_context_t *cmd_ctx) int remove_connection(service_t *service, connection_t *connection) { - connection_t *c, *p = NULL; - + connection_t *c = service->connections; + /* find connection */ - for (c = service->connections; c; c = c->next) + while(c) { + connection_t *next = c->next; + if (c->fd == connection->fd) - { - /* unlink connection */ - if (p) - p->next = c->next; - else - service->connections = c->next; - + { + service->connections = next; service->connection_closed(c); close(c->fd); @@ -112,7 +109,7 @@ int remove_connection(service_t *service, connection_t *connection) } /* remember the last connection for unlinking */ - p = c; + c = next; } return ERROR_OK; @@ -182,28 +179,27 @@ int add_service(char *name, enum connection_type type, unsigned short port, int int remove_service(unsigned short port) { - service_t *c, *p = NULL; - + service_t *c = services; + /* find service */ - for (c = services; c; c = c->next) + while(c) { + service_t *next = c->next; + if (c->port == port) - { - /* unlink service */ - if (p) - p->next = c->next; - else - services = c->next; - + { if (c->name) free(c->name); + if (c->priv) + free(c->priv); + /* delete service */ free(c); } /* remember the last service for unlinking */ - p = c; + c = next; } return ERROR_OK; |