diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-12-08 23:28:37 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-12-08 23:28:37 +0000 |
commit | 05ce089eb0937591ea22802fc669dffed4219222 (patch) | |
tree | dba48c58cbc3511d8a83c26bce0a2a1becce2e3e /src/util/server_nc.c | |
parent | 7aefe171ca7e80b770826b209e10556cc7d2f15c (diff) | |
download | gnunet-05ce089eb0937591ea22802fc669dffed4219222.tar.gz gnunet-05ce089eb0937591ea22802fc669dffed4219222.zip |
-cleanup
Diffstat (limited to 'src/util/server_nc.c')
-rw-r--r-- | src/util/server_nc.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/util/server_nc.c b/src/util/server_nc.c index d6625eefb..0074ea935 100644 --- a/src/util/server_nc.c +++ b/src/util/server_nc.c | |||
@@ -147,11 +147,12 @@ struct GNUNET_SERVER_NotificationContext | |||
147 | /** | 147 | /** |
148 | * Client has disconnected, clean up. | 148 | * Client has disconnected, clean up. |
149 | * | 149 | * |
150 | * @param cls our 'struct GNUNET_SERVER_NotificationContext *' | 150 | * @param cls our `struct GNUNET_SERVER_NotificationContext *` |
151 | * @param client handle of client that disconnected | 151 | * @param client handle of client that disconnected |
152 | */ | 152 | */ |
153 | static void | 153 | static void |
154 | handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client) | 154 | handle_client_disconnect (void *cls, |
155 | struct GNUNET_SERVER_Client *client) | ||
155 | { | 156 | { |
156 | struct GNUNET_SERVER_NotificationContext *nc = cls; | 157 | struct GNUNET_SERVER_NotificationContext *nc = cls; |
157 | struct ClientList *pos; | 158 | struct ClientList *pos; |
@@ -205,7 +206,7 @@ GNUNET_SERVER_notification_context_create (struct GNUNET_SERVER_Handle *server, | |||
205 | { | 206 | { |
206 | struct GNUNET_SERVER_NotificationContext *ret; | 207 | struct GNUNET_SERVER_NotificationContext *ret; |
207 | 208 | ||
208 | ret = GNUNET_malloc (sizeof (struct GNUNET_SERVER_NotificationContext)); | 209 | ret = GNUNET_new (struct GNUNET_SERVER_NotificationContext); |
209 | ret->server = server; | 210 | ret->server = server; |
210 | ret->queue_length = queue_length; | 211 | ret->queue_length = queue_length; |
211 | GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, ret); | 212 | GNUNET_SERVER_disconnect_notify (server, &handle_client_disconnect, ret); |
@@ -219,9 +220,7 @@ GNUNET_SERVER_notification_context_create (struct GNUNET_SERVER_Handle *server, | |||
219 | * @param nc context to destroy. | 220 | * @param nc context to destroy. |
220 | */ | 221 | */ |
221 | void | 222 | void |
222 | GNUNET_SERVER_notification_context_destroy (struct | 223 | GNUNET_SERVER_notification_context_destroy (struct GNUNET_SERVER_NotificationContext *nc) |
223 | GNUNET_SERVER_NotificationContext | ||
224 | *nc) | ||
225 | { | 224 | { |
226 | struct ClientList *pos; | 225 | struct ClientList *pos; |
227 | struct PendingMessageList *pml; | 226 | struct PendingMessageList *pml; |
@@ -260,8 +259,7 @@ GNUNET_SERVER_notification_context_destroy (struct | |||
260 | * @param client client to add | 259 | * @param client client to add |
261 | */ | 260 | */ |
262 | void | 261 | void |
263 | GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext | 262 | GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext *nc, |
264 | *nc, | ||
265 | struct GNUNET_SERVER_Client *client) | 263 | struct GNUNET_SERVER_Client *client) |
266 | { | 264 | { |
267 | struct ClientList *cl; | 265 | struct ClientList *cl; |
@@ -269,7 +267,7 @@ GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext | |||
269 | for (cl = nc->clients_head; NULL != cl; cl = cl->next) | 267 | for (cl = nc->clients_head; NULL != cl; cl = cl->next) |
270 | if (cl->client == client) | 268 | if (cl->client == client) |
271 | return; /* already present */ | 269 | return; /* already present */ |
272 | cl = GNUNET_malloc (sizeof (struct ClientList)); | 270 | cl = GNUNET_new (struct ClientList); |
273 | GNUNET_CONTAINER_DLL_insert (nc->clients_head, | 271 | GNUNET_CONTAINER_DLL_insert (nc->clients_head, |
274 | nc->clients_tail, | 272 | nc->clients_tail, |
275 | cl); | 273 | cl); |
@@ -281,11 +279,11 @@ GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext | |||
281 | 279 | ||
282 | /** | 280 | /** |
283 | * Function called to notify a client about the socket begin ready to | 281 | * Function called to notify a client about the socket begin ready to |
284 | * queue more data. "buf" will be NULL and "size" zero if the socket | 282 | * queue more data. @a buf will be NULL and @a size zero if the socket |
285 | * was closed for writing in the meantime. | 283 | * was closed for writing in the meantime. |
286 | * | 284 | * |
287 | * @param cls the 'struct ClientList *' | 285 | * @param cls the `struct ClientList *` |
288 | * @param size number of bytes available in buf | 286 | * @param size number of bytes available in @a buf |
289 | * @param buf where the callee should write the message | 287 | * @param buf where the callee should write the message |
290 | * @return number of bytes written to buf | 288 | * @return number of bytes written to buf |
291 | */ | 289 | */ |
@@ -350,7 +348,8 @@ transmit_message (void *cls, size_t size, void *buf) | |||
350 | */ | 348 | */ |
351 | static void | 349 | static void |
352 | do_unicast (struct GNUNET_SERVER_NotificationContext *nc, | 350 | do_unicast (struct GNUNET_SERVER_NotificationContext *nc, |
353 | struct ClientList *client, const struct GNUNET_MessageHeader *msg, | 351 | struct ClientList *client, |
352 | const struct GNUNET_MessageHeader *msg, | ||
354 | int can_drop) | 353 | int can_drop) |
355 | { | 354 | { |
356 | struct PendingMessageList *pml; | 355 | struct PendingMessageList *pml; |
@@ -401,11 +400,10 @@ do_unicast (struct GNUNET_SERVER_NotificationContext *nc, | |||
401 | */ | 400 | */ |
402 | void | 401 | void |
403 | GNUNET_SERVER_notification_context_unicast (struct | 402 | GNUNET_SERVER_notification_context_unicast (struct |
404 | GNUNET_SERVER_NotificationContext | 403 | GNUNET_SERVER_NotificationContext *nc, |
405 | *nc, | ||
406 | struct GNUNET_SERVER_Client *client, | 404 | struct GNUNET_SERVER_Client *client, |
407 | const struct GNUNET_MessageHeader | 405 | const struct GNUNET_MessageHeader *msg, |
408 | *msg, int can_drop) | 406 | int can_drop) |
409 | { | 407 | { |
410 | struct ClientList *pos; | 408 | struct ClientList *pos; |
411 | 409 | ||
@@ -426,10 +424,9 @@ GNUNET_SERVER_notification_context_unicast (struct | |||
426 | */ | 424 | */ |
427 | void | 425 | void |
428 | GNUNET_SERVER_notification_context_broadcast (struct | 426 | GNUNET_SERVER_notification_context_broadcast (struct |
429 | GNUNET_SERVER_NotificationContext | 427 | GNUNET_SERVER_NotificationContext *nc, |
430 | *nc, | 428 | const struct GNUNET_MessageHeader *msg, |
431 | const struct GNUNET_MessageHeader | 429 | int can_drop) |
432 | *msg, int can_drop) | ||
433 | { | 430 | { |
434 | struct ClientList *pos; | 431 | struct ClientList *pos; |
435 | 432 | ||