aboutsummaryrefslogtreecommitdiff
path: root/src/util/server_nc.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-04-21 15:16:45 +0000
committerChristian Grothoff <christian@grothoff.org>2012-04-21 15:16:45 +0000
commita5ca53b73e643a0e62ded4ac9595bff38d08cb0b (patch)
treeeaf74f5b38c35e1530f9d49946db01a13cce3217 /src/util/server_nc.c
parent90c9abc573f95de334a1f61faa089e79046d2f11 (diff)
downloadgnunet-a5ca53b73e643a0e62ded4ac9595bff38d08cb0b.tar.gz
gnunet-a5ca53b73e643a0e62ded4ac9595bff38d08cb0b.zip
-misc offline hacking / code cleanup in util
Diffstat (limited to 'src/util/server_nc.c')
-rw-r--r--src/util/server_nc.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/src/util/server_nc.c b/src/util/server_nc.c
index 9717a4516..deb1a18c9 100644
--- a/src/util/server_nc.c
+++ b/src/util/server_nc.c
@@ -36,8 +36,6 @@
36#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) 36#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
37 37
38 38
39#define DEBUG_SERVER_NC GNUNET_EXTRA_LOGGING
40
41/** 39/**
42 * Entry in list of messages pending to be transmitted. 40 * Entry in list of messages pending to be transmitted.
43 */ 41 */
@@ -171,11 +169,9 @@ handle_client_disconnect (void *cls, struct GNUNET_SERVER_Client *client)
171 } 169 }
172 if (pos == NULL) 170 if (pos == NULL)
173 return; 171 return;
174#if DEBUG_SERVER_NC
175 LOG (GNUNET_ERROR_TYPE_DEBUG, 172 LOG (GNUNET_ERROR_TYPE_DEBUG,
176 "Client disconnected, cleaning up %u messages in NC queue\n", 173 "Client disconnected, cleaning up %u messages in NC queue\n",
177 pos->num_pending); 174 pos->num_pending);
178#endif
179 if (prev == NULL) 175 if (prev == NULL)
180 nc->clients = pos->next; 176 nc->clients = pos->next;
181 else 177 else
@@ -297,10 +293,8 @@ transmit_message (void *cls, size_t size, void *buf)
297 if (buf == NULL) 293 if (buf == NULL)
298 { 294 {
299 /* 'cl' should be freed via disconnect notification shortly */ 295 /* 'cl' should be freed via disconnect notification shortly */
300#if DEBUG_SERVER_NC
301 LOG (GNUNET_ERROR_TYPE_DEBUG, 296 LOG (GNUNET_ERROR_TYPE_DEBUG,
302 "Failed to transmit message from NC queue to client\n"); 297 "Failed to transmit message from NC queue to client\n");
303#endif
304 return 0; 298 return 0;
305 } 299 }
306 ret = 0; 300 ret = 0;
@@ -310,11 +304,9 @@ transmit_message (void *cls, size_t size, void *buf)
310 if (size < msize) 304 if (size < msize)
311 break; 305 break;
312 GNUNET_CONTAINER_DLL_remove (cl->pending_head, cl->pending_tail, pml); 306 GNUNET_CONTAINER_DLL_remove (cl->pending_head, cl->pending_tail, pml);
313#if DEBUG_SERVER_NC
314 LOG (GNUNET_ERROR_TYPE_DEBUG, 307 LOG (GNUNET_ERROR_TYPE_DEBUG,
315 "Copying message of type %u and size %u from pending queue to transmission buffer\n", 308 "Copying message of type %u and size %u from pending queue to transmission buffer\n",
316 ntohs (pml->msg->type), msize); 309 ntohs (pml->msg->type), msize);
317#endif
318 memcpy (&cbuf[ret], pml->msg, msize); 310 memcpy (&cbuf[ret], pml->msg, msize);
319 ret += msize; 311 ret += msize;
320 size -= msize; 312 size -= msize;
@@ -323,11 +315,9 @@ transmit_message (void *cls, size_t size, void *buf)
323 } 315 }
324 if (pml != NULL) 316 if (pml != NULL)
325 { 317 {
326#if DEBUG_SERVER_NC
327 LOG (GNUNET_ERROR_TYPE_DEBUG, 318 LOG (GNUNET_ERROR_TYPE_DEBUG,
328 "Have %u messages left in NC queue, will try transmission again\n", 319 "Have %u messages left in NC queue, will try transmission again\n",
329 cl->num_pending); 320 cl->num_pending);
330#endif
331 cl->th = 321 cl->th =
332 GNUNET_SERVER_notify_transmit_ready (cl->client, ntohs (pml->msg->size), 322 GNUNET_SERVER_notify_transmit_ready (cl->client, ntohs (pml->msg->size),
333 GNUNET_TIME_UNIT_FOREVER_REL, 323 GNUNET_TIME_UNIT_FOREVER_REL,
@@ -372,11 +362,9 @@ do_unicast (struct GNUNET_SERVER_NotificationContext *nc,
372 pml = GNUNET_malloc (sizeof (struct PendingMessageList) + size); 362 pml = GNUNET_malloc (sizeof (struct PendingMessageList) + size);
373 pml->msg = (const struct GNUNET_MessageHeader *) &pml[1]; 363 pml->msg = (const struct GNUNET_MessageHeader *) &pml[1];
374 pml->can_drop = can_drop; 364 pml->can_drop = can_drop;
375#if DEBUG_SERVER_NC
376 LOG (GNUNET_ERROR_TYPE_DEBUG, 365 LOG (GNUNET_ERROR_TYPE_DEBUG,
377 "Adding message of type %u and size %u to pending queue (which has %u entries)\n", 366 "Adding message of type %u and size %u to pending queue (which has %u entries)\n",
378 ntohs (msg->type), ntohs (msg->size), (unsigned int) nc->queue_length); 367 ntohs (msg->type), ntohs (msg->size), (unsigned int) nc->queue_length);
379#endif
380 memcpy (&pml[1], msg, size); 368 memcpy (&pml[1], msg, size);
381 /* append */ 369 /* append */
382 GNUNET_CONTAINER_DLL_insert_tail (client->pending_head, client->pending_tail, 370 GNUNET_CONTAINER_DLL_insert_tail (client->pending_head, client->pending_tail,