aboutsummaryrefslogtreecommitdiff
path: root/src/transport/gnunet-service-transport_blacklist.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-02-04 13:57:36 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-02-04 13:57:36 +0000
commit0066ca2f9086d3d4153849ed7a0edac5afb11f15 (patch)
treebca7fce7b7a14a508aae012d4176841cbf406fa9 /src/transport/gnunet-service-transport_blacklist.c
parentfd9d95880c1a2fa5c8ba7d72b233ad0e9b1c5b34 (diff)
downloadgnunet-0066ca2f9086d3d4153849ed7a0edac5afb11f15.tar.gz
gnunet-0066ca2f9086d3d4153849ed7a0edac5afb11f15.zip
fix for 3300: remember to call client_receive_done for blacklist client
Diffstat (limited to 'src/transport/gnunet-service-transport_blacklist.c')
-rw-r--r--src/transport/gnunet-service-transport_blacklist.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c
index 98551a495..c3b02f845 100644
--- a/src/transport/gnunet-service-transport_blacklist.c
+++ b/src/transport/gnunet-service-transport_blacklist.c
@@ -104,6 +104,11 @@ struct Blacklisters
104 */ 104 */
105 int waiting_for_reply; 105 int waiting_for_reply;
106 106
107 /**
108 * GNUNET_YES if we have to call receive_done for this client
109 */
110 int call_receive_done;
111
107}; 112};
108 113
109 114
@@ -387,15 +392,20 @@ transmit_blacklist_message (void *cls, size_t size, void *buf)
387 return 0; 392 return 0;
388 } 393 }
389 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 394 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
390 "Sending blacklist test for peer `%s' to client\n", 395 "Sending blacklist test for peer `%s' to client %p\n",
391 GNUNET_i2s (&bc->peer)); 396 GNUNET_i2s (&bc->peer), bc->bl_pos->client);
392 bl = bc->bl_pos; 397 bl = bc->bl_pos;
393 bm.header.size = htons (sizeof (struct BlacklistMessage)); 398 bm.header.size = htons (sizeof (struct BlacklistMessage));
394 bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY); 399 bm.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_QUERY);
395 bm.is_allowed = htonl (0); 400 bm.is_allowed = htonl (0);
396 bm.peer = bc->peer; 401 bm.peer = bc->peer;
397 memcpy (buf, &bm, sizeof (bm)); 402 memcpy (buf, &bm, sizeof (bm));
398 GNUNET_SERVER_receive_done (bl->client, GNUNET_OK); 403 if (GNUNET_YES == bl->call_receive_done)
404 {
405 GNUNET_SERVER_receive_done (bl->client, GNUNET_OK);
406 bl->call_receive_done = GNUNET_NO;
407 }
408
399 bl->waiting_for_reply = GNUNET_YES; 409 bl->waiting_for_reply = GNUNET_YES;
400 return sizeof (bm); 410 return sizeof (bm);
401} 411}
@@ -540,12 +550,16 @@ GST_blacklist_handle_init (void *cls, struct GNUNET_SERVER_Client *client,
540 } 550 }
541 bl = bl->next; 551 bl = bl->next;
542 } 552 }
553
543 GNUNET_SERVER_client_mark_monitor (client); 554 GNUNET_SERVER_client_mark_monitor (client);
544 bl = GNUNET_new (struct Blacklisters); 555 bl = GNUNET_new (struct Blacklisters);
545 bl->client = client; 556 bl->client = client;
557 bl->call_receive_done = GNUNET_YES;
546 GNUNET_SERVER_client_keep (client); 558 GNUNET_SERVER_client_keep (client);
547 GNUNET_CONTAINER_DLL_insert_after (bl_head, bl_tail, bl_tail, bl); 559 GNUNET_CONTAINER_DLL_insert_after (bl_head, bl_tail, bl_tail, bl);
548 560
561 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "New blacklist client %p\n", client);
562
549 /* confirm that all existing connections are OK! */ 563 /* confirm that all existing connections are OK! */
550 tcc.bl = bl; 564 tcc.bl = bl;
551 tcc.first = GNUNET_YES; 565 tcc.first = GNUNET_YES;
@@ -578,9 +592,14 @@ GST_blacklist_handle_reply (void *cls, struct GNUNET_SERVER_Client *client,
578 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 592 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
579 return; 593 return;
580 } 594 }
595
596 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Blacklist client %p sent reply for `%s'\n",
597 client, GNUNET_i2s(&msg->peer));
598
581 bc = bl->bc; 599 bc = bl->bc;
582 bl->bc = NULL; 600 bl->bc = NULL;
583 bl->waiting_for_reply = GNUNET_NO; 601 bl->waiting_for_reply = GNUNET_NO;
602 bl->call_receive_done = GNUNET_YES; /* Remember to call receive_done */
584 if (NULL != bc) 603 if (NULL != bc)
585 { 604 {
586 /* only run this if the blacklist check has not been 605 /* only run this if the blacklist check has not been
@@ -592,6 +611,7 @@ GST_blacklist_handle_reply (void *cls, struct GNUNET_SERVER_Client *client,
592 bc->cont (bc->cont_cls, &bc->peer, GNUNET_NO); 611 bc->cont (bc->cont_cls, &bc->peer, GNUNET_NO);
593 GNUNET_CONTAINER_DLL_remove (bc_head, bc_tail, bc); 612 GNUNET_CONTAINER_DLL_remove (bc_head, bc_tail, bc);
594 GNUNET_SERVER_receive_done (bl->client, GNUNET_OK); 613 GNUNET_SERVER_receive_done (bl->client, GNUNET_OK);
614 bl->call_receive_done = GNUNET_NO;
595 GNUNET_free (bc); 615 GNUNET_free (bc);
596 return; 616 return;
597 } 617 }
@@ -603,7 +623,7 @@ GST_blacklist_handle_reply (void *cls, struct GNUNET_SERVER_Client *client,
603 bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc); 623 bc->task = GNUNET_SCHEDULER_add_now (&do_blacklist_check, bc);
604 } 624 }
605 } 625 }
606 /* check if any other bc's are waiting for this blacklister */ 626 /* check if any other blacklist checks are waiting for this blacklister */
607 for (bc = bc_head; bc != NULL; bc = bc->next) 627 for (bc = bc_head; bc != NULL; bc = bc->next)
608 if ((bc->bl_pos == bl) && (GNUNET_SCHEDULER_NO_TASK == bc->task)) 628 if ((bc->bl_pos == bl) && (GNUNET_SCHEDULER_NO_TASK == bc->task))
609 { 629 {