diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-13 21:01:22 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-13 21:01:22 +0000 |
commit | 0b66a17293953e905668cc5b5764068b65b9f4c1 (patch) | |
tree | 9ead8563d8e8d744553c81305997c34a9af1d9df /src/ats/gnunet-service-ats_performance.c | |
parent | f84a545ddf6cfb8b4cf59c9ef40117cd23d836b4 (diff) | |
download | gnunet-0b66a17293953e905668cc5b5764068b65b9f4c1.tar.gz gnunet-0b66a17293953e905668cc5b5764068b65b9f4c1.zip |
more client disconnect code
Diffstat (limited to 'src/ats/gnunet-service-ats_performance.c')
-rw-r--r-- | src/ats/gnunet-service-ats_performance.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ats/gnunet-service-ats_performance.c b/src/ats/gnunet-service-ats_performance.c index fa60e4973..edad22512 100644 --- a/src/ats/gnunet-service-ats_performance.c +++ b/src/ats/gnunet-service-ats_performance.c | |||
@@ -48,6 +48,18 @@ static struct PerformanceClient *pc_head; | |||
48 | * Tail of linked list of all clients to this service. | 48 | * Tail of linked list of all clients to this service. |
49 | */ | 49 | */ |
50 | static struct PerformanceClient *pc_tail; | 50 | static struct PerformanceClient *pc_tail; |
51 | |||
52 | |||
53 | static struct PerformanceClient * | ||
54 | find_client (struct GNUNET_SERVER_Client *client) | ||
55 | { | ||
56 | struct PerformanceClient * pc; | ||
57 | |||
58 | for (pc = pc_head; pc != NULL; pc = pc->next) | ||
59 | if (pc->client == client) | ||
60 | return pc; | ||
61 | return NULL; | ||
62 | } | ||
51 | 63 | ||
52 | 64 | ||
53 | void | 65 | void |
@@ -55,6 +67,7 @@ GAS_add_performance_client (struct GNUNET_SERVER_Client *client) | |||
55 | { | 67 | { |
56 | struct PerformanceClient * pc; | 68 | struct PerformanceClient * pc; |
57 | 69 | ||
70 | GNUNET_break (NULL == find_client (client)); | ||
58 | pc = GNUNET_malloc (sizeof (struct PerformanceClient)); | 71 | pc = GNUNET_malloc (sizeof (struct PerformanceClient)); |
59 | pc->client = client; | 72 | pc->client = client; |
60 | GNUNET_CONTAINER_DLL_insert(pc_head, pc_tail, pc); | 73 | GNUNET_CONTAINER_DLL_insert(pc_head, pc_tail, pc); |
@@ -64,6 +77,14 @@ GAS_add_performance_client (struct GNUNET_SERVER_Client *client) | |||
64 | void | 77 | void |
65 | GAS_remove_performance_client (struct GNUNET_SERVER_Client *client) | 78 | GAS_remove_performance_client (struct GNUNET_SERVER_Client *client) |
66 | { | 79 | { |
80 | struct PerformanceClient * pc; | ||
81 | |||
82 | pc = find_client (client); | ||
83 | if (NULL == pc) | ||
84 | return; | ||
85 | GNUNET_CONTAINER_DLL_remove (pc_head, pc_tail, pc); | ||
86 | GNUNET_SERVER_client_drop (client); | ||
87 | GNUNET_free (pc); | ||
67 | } | 88 | } |
68 | 89 | ||
69 | 90 | ||