aboutsummaryrefslogtreecommitdiff
path: root/src/util/server_nc.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-11-23 20:38:01 +0000
committerChristian Grothoff <christian@grothoff.org>2014-11-23 20:38:01 +0000
commit3fb00702b5ebd54301d5827774fbebcd11d206c9 (patch)
treecb48e64feb8e598653b776be8d90d5d6e0d9c167 /src/util/server_nc.c
parent7e60f24441ae84fe5aa965a09805e25996423886 (diff)
downloadgnunet-3fb00702b5ebd54301d5827774fbebcd11d206c9.tar.gz
gnunet-3fb00702b5ebd54301d5827774fbebcd11d206c9.zip
-fix indent
Diffstat (limited to 'src/util/server_nc.c')
-rw-r--r--src/util/server_nc.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/util/server_nc.c b/src/util/server_nc.c
index 416c71afd..4e54cf464 100644
--- a/src/util/server_nc.c
+++ b/src/util/server_nc.c
@@ -176,7 +176,9 @@ handle_client_disconnect (void *cls,
176 pos); 176 pos);
177 while (NULL != (pml = pos->pending_head)) 177 while (NULL != (pml = pos->pending_head))
178 { 178 {
179 GNUNET_CONTAINER_DLL_remove (pos->pending_head, pos->pending_tail, pml); 179 GNUNET_CONTAINER_DLL_remove (pos->pending_head,
180 pos->pending_tail,
181 pml);
180 GNUNET_free (pml); 182 GNUNET_free (pml);
181 pos->num_pending--; 183 pos->num_pending--;
182 } 184 }
@@ -238,7 +240,9 @@ GNUNET_SERVER_notification_context_destroy (struct GNUNET_SERVER_NotificationCon
238 GNUNET_SERVER_client_drop (pos->client); 240 GNUNET_SERVER_client_drop (pos->client);
239 while (NULL != (pml = pos->pending_head)) 241 while (NULL != (pml = pos->pending_head))
240 { 242 {
241 GNUNET_CONTAINER_DLL_remove (pos->pending_head, pos->pending_tail, pml); 243 GNUNET_CONTAINER_DLL_remove (pos->pending_head,
244 pos->pending_tail,
245 pml);
242 GNUNET_free (pml); 246 GNUNET_free (pml);
243 pos->num_pending--; 247 pos->num_pending--;
244 } 248 }
@@ -247,7 +251,8 @@ GNUNET_SERVER_notification_context_destroy (struct GNUNET_SERVER_NotificationCon
247 } 251 }
248 if (NULL != nc->server) 252 if (NULL != nc->server)
249 GNUNET_SERVER_disconnect_notify_cancel (nc->server, 253 GNUNET_SERVER_disconnect_notify_cancel (nc->server,
250 &handle_client_disconnect, nc); 254 &handle_client_disconnect,
255 nc);
251 GNUNET_free (nc); 256 GNUNET_free (nc);
252} 257}
253 258
@@ -288,7 +293,9 @@ GNUNET_SERVER_notification_context_add (struct GNUNET_SERVER_NotificationContext
288 * @return number of bytes written to buf 293 * @return number of bytes written to buf
289 */ 294 */
290static size_t 295static size_t
291transmit_message (void *cls, size_t size, void *buf) 296transmit_message (void *cls,
297 size_t size,
298 void *buf)
292{ 299{
293 struct ClientList *cl = cls; 300 struct ClientList *cl = cls;
294 char *cbuf = buf; 301 char *cbuf = buf;
@@ -310,10 +317,13 @@ transmit_message (void *cls, size_t size, void *buf)
310 msize = ntohs (pml->msg->size); 317 msize = ntohs (pml->msg->size);
311 if (size < msize) 318 if (size < msize)
312 break; 319 break;
313 GNUNET_CONTAINER_DLL_remove (cl->pending_head, cl->pending_tail, pml); 320 GNUNET_CONTAINER_DLL_remove (cl->pending_head,
321 cl->pending_tail,
322 pml);
314 LOG (GNUNET_ERROR_TYPE_DEBUG, 323 LOG (GNUNET_ERROR_TYPE_DEBUG,
315 "Copying message of type %u and size %u from pending queue to transmission buffer\n", 324 "Copying message of type %u and size %u from pending queue to transmission buffer\n",
316 ntohs (pml->msg->type), msize); 325 ntohs (pml->msg->type),
326 msize);
317 memcpy (&cbuf[ret], pml->msg, msize); 327 memcpy (&cbuf[ret], pml->msg, msize);
318 ret += msize; 328 ret += msize;
319 size -= msize; 329 size -= msize;
@@ -326,7 +336,8 @@ transmit_message (void *cls, size_t size, void *buf)
326 "Have %u messages left in NC queue, will try transmission again\n", 336 "Have %u messages left in NC queue, will try transmission again\n",
327 cl->num_pending); 337 cl->num_pending);
328 cl->th = 338 cl->th =
329 GNUNET_SERVER_notify_transmit_ready (cl->client, ntohs (pml->msg->size), 339 GNUNET_SERVER_notify_transmit_ready (cl->client,
340 ntohs (pml->msg->size),
330 GNUNET_TIME_UNIT_FOREVER_REL, 341 GNUNET_TIME_UNIT_FOREVER_REL,
331 &transmit_message, cl); 342 &transmit_message, cl);
332 } 343 }
@@ -355,7 +366,8 @@ do_unicast (struct GNUNET_SERVER_NotificationContext *nc,
355 struct PendingMessageList *pml; 366 struct PendingMessageList *pml;
356 uint16_t size; 367 uint16_t size;
357 368
358 if ((client->num_pending > nc->queue_length) && (GNUNET_YES == can_drop)) 369 if ( (client->num_pending > nc->queue_length) &&
370 (GNUNET_YES == can_drop) )
359 { 371 {
360 LOG (GNUNET_ERROR_TYPE_INFO, 372 LOG (GNUNET_ERROR_TYPE_INFO,
361 "Dropping message of type %u and size %u due to full queue (%u entries)\n", 373 "Dropping message of type %u and size %u due to full queue (%u entries)\n",
@@ -374,10 +386,13 @@ do_unicast (struct GNUNET_SERVER_NotificationContext *nc,
374 pml->can_drop = can_drop; 386 pml->can_drop = can_drop;
375 LOG (GNUNET_ERROR_TYPE_DEBUG, 387 LOG (GNUNET_ERROR_TYPE_DEBUG,
376 "Adding message of type %u and size %u to pending queue (which has %u entries)\n", 388 "Adding message of type %u and size %u to pending queue (which has %u entries)\n",
377 ntohs (msg->type), ntohs (msg->size), (unsigned int) nc->queue_length); 389 ntohs (msg->type),
390 ntohs (msg->size),
391 (unsigned int) nc->queue_length);
378 memcpy (&pml[1], msg, size); 392 memcpy (&pml[1], msg, size);
379 /* append */ 393 /* append */
380 GNUNET_CONTAINER_DLL_insert_tail (client->pending_head, client->pending_tail, 394 GNUNET_CONTAINER_DLL_insert_tail (client->pending_head,
395 client->pending_tail,
381 pml); 396 pml);
382 if (NULL == client->th) 397 if (NULL == client->th)
383 client->th = 398 client->th =
@@ -399,8 +414,7 @@ do_unicast (struct GNUNET_SERVER_NotificationContext *nc,
399 * @param can_drop can this message be dropped due to queue length limitations 414 * @param can_drop can this message be dropped due to queue length limitations
400 */ 415 */
401void 416void
402GNUNET_SERVER_notification_context_unicast (struct 417GNUNET_SERVER_notification_context_unicast (struct GNUNET_SERVER_NotificationContext *nc,
403 GNUNET_SERVER_NotificationContext *nc,
404 struct GNUNET_SERVER_Client *client, 418 struct GNUNET_SERVER_Client *client,
405 const struct GNUNET_MessageHeader *msg, 419 const struct GNUNET_MessageHeader *msg,
406 int can_drop) 420 int can_drop)