diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-12-20 15:18:13 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-12-20 15:18:13 +0000 |
commit | 32b8d7b6b2a32bca39e3ee7311df9f98615ac387 (patch) | |
tree | cff73f69547dcd6d2743cf009dce0288a025b9dc | |
parent | c75554cf75ee449294f3926311638921185011d0 (diff) | |
download | gnunet-32b8d7b6b2a32bca39e3ee7311df9f98615ac387.tar.gz gnunet-32b8d7b6b2a32bca39e3ee7311df9f98615ac387.zip |
-simplify logic
-rw-r--r-- | src/transport/gnunet-service-transport_clients.c | 197 |
1 files changed, 88 insertions, 109 deletions
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index c016b4abf..642e309e6 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -141,7 +141,9 @@ struct AddressToStringContext | |||
141 | 141 | ||
142 | 142 | ||
143 | /** | 143 | /** |
144 | * Client monitoring changes of active addresses of our neighbours. | 144 | * Client monitoring changes of active addresses or validations |
145 | * of our neighbours. Which type is being monitored depends on the | ||
146 | * DLL this struct is in. | ||
145 | */ | 147 | */ |
146 | struct MonitoringClient | 148 | struct MonitoringClient |
147 | { | 149 | { |
@@ -373,10 +375,12 @@ setup_val_monitoring_client (struct GNUNET_SERVER_Client *client, | |||
373 | sizeof (struct GNUNET_PeerIdentity))) | 375 | sizeof (struct GNUNET_PeerIdentity))) |
374 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 376 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
375 | "Client %p started monitoring of the peer `%s'\n", | 377 | "Client %p started monitoring of the peer `%s'\n", |
376 | mc, GNUNET_i2s (peer)); | 378 | mc, |
379 | GNUNET_i2s (peer)); | ||
377 | else | 380 | else |
378 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 381 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
379 | "Client %p started monitoring all peers\n", mc); | 382 | "Client %p started monitoring all peers\n", |
383 | mc); | ||
380 | return mc; | 384 | return mc; |
381 | } | 385 | } |
382 | 386 | ||
@@ -466,8 +470,8 @@ unicast (struct TransportClient *tc, | |||
466 | if ( (tc->message_count >= MAX_PENDING) && | 470 | if ( (tc->message_count >= MAX_PENDING) && |
467 | (GNUNET_YES == may_drop) ) | 471 | (GNUNET_YES == may_drop) ) |
468 | { | 472 | { |
469 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 473 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
470 | _("Dropping message of type %u and size %u, have %u/%u messages pending\n"), | 474 | "Dropping message of type %u and size %u, have %u/%u messages pending\n", |
471 | ntohs (msg->type), | 475 | ntohs (msg->type), |
472 | ntohs (msg->size), | 476 | ntohs (msg->size), |
473 | tc->message_count, | 477 | tc->message_count, |
@@ -534,11 +538,13 @@ client_disconnect_notification (void *cls, | |||
534 | tc = lookup_client (client); | 538 | tc = lookup_client (client); |
535 | if (NULL == tc) | 539 | if (NULL == tc) |
536 | return; | 540 | return; |
537 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | 541 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
538 | "Client %p disconnected, cleaning up.\n", tc); | 542 | "Client %p disconnected, cleaning up.\n", |
543 | tc); | ||
539 | while (NULL != (mqe = tc->message_queue_head)) | 544 | while (NULL != (mqe = tc->message_queue_head)) |
540 | { | 545 | { |
541 | GNUNET_CONTAINER_DLL_remove (tc->message_queue_head, tc->message_queue_tail, | 546 | GNUNET_CONTAINER_DLL_remove (tc->message_queue_head, |
547 | tc->message_queue_tail, | ||
542 | mqe); | 548 | mqe); |
543 | tc->message_count--; | 549 | tc->message_count--; |
544 | GNUNET_free (mqe); | 550 | GNUNET_free (mqe); |
@@ -577,21 +583,16 @@ notify_client_about_neighbour (void *cls, | |||
577 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) | 583 | struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) |
578 | { | 584 | { |
579 | struct TransportClient *tc = cls; | 585 | struct TransportClient *tc = cls; |
580 | struct ConnectInfoMessage *cim; | 586 | struct ConnectInfoMessage cim; |
581 | size_t size = sizeof (struct ConnectInfoMessage); | ||
582 | char buf[size] GNUNET_ALIGN; | ||
583 | 587 | ||
584 | if (GNUNET_NO == GST_neighbours_test_connected (peer)) | 588 | if (GNUNET_NO == GST_neighbours_test_connected (peer)) |
585 | return; | 589 | return; |
586 | 590 | cim.header.size = htons (sizeof (struct ConnectInfoMessage)); | |
587 | GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE); | 591 | cim.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); |
588 | cim = (struct ConnectInfoMessage *) buf; | 592 | cim.id = *peer; |
589 | cim->header.size = htons (size); | 593 | cim.quota_in = bandwidth_in; |
590 | cim->header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_CONNECT); | 594 | cim.quota_out = bandwidth_out; |
591 | cim->id = *peer; | 595 | unicast (tc, &cim.header, GNUNET_NO); |
592 | cim->quota_in = bandwidth_in; | ||
593 | cim->quota_out = bandwidth_out; | ||
594 | unicast (tc, &cim->header, GNUNET_NO); | ||
595 | } | 596 | } |
596 | 597 | ||
597 | 598 | ||
@@ -614,15 +615,11 @@ clients_handle_start (void *cls, | |||
614 | uint32_t options; | 615 | uint32_t options; |
615 | 616 | ||
616 | tc = lookup_client (client); | 617 | tc = lookup_client (client); |
617 | 618 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |
618 | GNUNET_log (GNUNET_ERROR_TYPE_INFO | GNUNET_ERROR_TYPE_BULK, | ||
619 | "Client %p sent START\n", tc); | 619 | "Client %p sent START\n", tc); |
620 | if (tc != NULL) | 620 | if (NULL != tc) |
621 | { | 621 | { |
622 | /* got 'start' twice from the same client, not allowed */ | 622 | /* got 'start' twice from the same client, not allowed */ |
623 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | ||
624 | "TransportClient %p ServerClient %p sent multiple START messages\n", | ||
625 | tc, tc->client); | ||
626 | GNUNET_break (0); | 623 | GNUNET_break (0); |
627 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 624 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
628 | return; | 625 | return; |
@@ -635,9 +632,7 @@ clients_handle_start (void *cls, | |||
635 | sizeof (struct GNUNET_PeerIdentity)))) | 632 | sizeof (struct GNUNET_PeerIdentity)))) |
636 | { | 633 | { |
637 | /* client thinks this is a different peer, reject */ | 634 | /* client thinks this is a different peer, reject */ |
638 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 635 | GNUNET_break (0); |
639 | _("Rejecting control connection from peer `%s', which is not me!\n"), | ||
640 | GNUNET_i2s (&start->self)); | ||
641 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 636 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
642 | return; | 637 | return; |
643 | } | 638 | } |
@@ -766,12 +761,6 @@ clients_handle_send (void *cls, | |||
766 | return; | 761 | return; |
767 | } | 762 | } |
768 | 763 | ||
769 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
770 | "Received `%s' request from client with target `%4s' and first message of type %u and total size %u\n", | ||
771 | "SEND", | ||
772 | GNUNET_i2s (&obm->peer), | ||
773 | ntohs (obmm->type), | ||
774 | msize); | ||
775 | if (GNUNET_NO == GST_neighbours_test_connected (&obm->peer)) | 764 | if (GNUNET_NO == GST_neighbours_test_connected (&obm->peer)) |
776 | { | 765 | { |
777 | /* not connected, not allowed to send; can happen due to asynchronous operations */ | 766 | /* not connected, not allowed to send; can happen due to asynchronous operations */ |
@@ -785,6 +774,12 @@ clients_handle_send (void *cls, | |||
785 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 774 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
786 | return; | 775 | return; |
787 | } | 776 | } |
777 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
778 | "Received `%s' request from client with target `%4s' and first message of type %u and total size %u\n", | ||
779 | "SEND", | ||
780 | GNUNET_i2s (&obm->peer), | ||
781 | ntohs (obmm->type), | ||
782 | msize); | ||
788 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 783 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
789 | stcc = GNUNET_new (struct SendTransmitContinuationContext); | 784 | stcc = GNUNET_new (struct SendTransmitContinuationContext); |
790 | stcc->target = obm->peer; | 785 | stcc->target = obm->peer; |
@@ -817,9 +812,8 @@ try_connect_if_allowed (void *cls, | |||
817 | GNUNET_i2s (peer)); | 812 | GNUNET_i2s (peer)); |
818 | return; /* not allowed */ | 813 | return; /* not allowed */ |
819 | } | 814 | } |
820 | |||
821 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 815 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
822 | _("Blacklist allows connection attempt to peer `%s'\n"), | 816 | "Blacklist allows connection attempt to peer `%s'\n", |
823 | GNUNET_i2s (peer)); | 817 | GNUNET_i2s (peer)); |
824 | 818 | ||
825 | GST_neighbours_try_connect (peer); | 819 | GST_neighbours_try_connect (peer); |
@@ -851,14 +845,11 @@ clients_handle_request_connect (void *cls, | |||
851 | sizeof (struct GNUNET_PeerIdentity))) | 845 | sizeof (struct GNUNET_PeerIdentity))) |
852 | { | 846 | { |
853 | GNUNET_break (0); | 847 | GNUNET_break (0); |
854 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
855 | "Received a request connect message myself `%s'\n", | ||
856 | GNUNET_i2s (&trcm->peer)); | ||
857 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 848 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
858 | return; | 849 | return; |
859 | } | 850 | } |
860 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 851 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
861 | _("Received a request connect message for peer `%s'\n"), | 852 | "Received a request connect message for peer `%s'\n", |
862 | GNUNET_i2s (&trcm->peer)); | 853 | GNUNET_i2s (&trcm->peer)); |
863 | (void) GST_blacklist_test_allowed (&trcm->peer, | 854 | (void) GST_blacklist_test_allowed (&trcm->peer, |
864 | NULL, | 855 | NULL, |
@@ -893,14 +884,11 @@ clients_handle_request_disconnect (void *cls, | |||
893 | sizeof (struct GNUNET_PeerIdentity))) | 884 | sizeof (struct GNUNET_PeerIdentity))) |
894 | { | 885 | { |
895 | GNUNET_break (0); | 886 | GNUNET_break (0); |
896 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
897 | "Received a request disconnect message myself `%s'\n", | ||
898 | GNUNET_i2s (&trdm->peer)); | ||
899 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 887 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
900 | return; | 888 | return; |
901 | } | 889 | } |
902 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 890 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
903 | _("Received a request disconnect message for peer `%s'\n"), | 891 | "Received a request disconnect message for peer `%s'\n", |
904 | GNUNET_i2s (&trdm->peer)); | 892 | GNUNET_i2s (&trdm->peer)); |
905 | (void) GST_neighbours_force_disconnect (&trdm->peer); | 893 | (void) GST_neighbours_force_disconnect (&trdm->peer); |
906 | GNUNET_SERVER_receive_done (client, GNUNET_OK); | 894 | GNUNET_SERVER_receive_done (client, GNUNET_OK); |
@@ -1136,7 +1124,10 @@ compose_validation_iterate_response_message (const struct GNUNET_PeerIdentity *p | |||
1136 | alen = address->address_length; | 1124 | alen = address->address_length; |
1137 | } | 1125 | } |
1138 | else | 1126 | else |
1139 | tlen = alen = 0; | 1127 | { |
1128 | tlen = 0; | ||
1129 | alen = 0; | ||
1130 | } | ||
1140 | size = (sizeof (struct ValidationIterateResponseMessage) + alen + tlen); | 1131 | size = (sizeof (struct ValidationIterateResponseMessage) + alen + tlen); |
1141 | msg = GNUNET_malloc (size); | 1132 | msg = GNUNET_malloc (size); |
1142 | msg->header.size = htons (size); | 1133 | msg->header.size = htons (size); |
@@ -1204,20 +1195,20 @@ send_validation_information (void *cls, | |||
1204 | struct IterationContext *pc = cls; | 1195 | struct IterationContext *pc = cls; |
1205 | struct ValidationIterateResponseMessage *msg; | 1196 | struct ValidationIterateResponseMessage *msg; |
1206 | 1197 | ||
1207 | if ( (GNUNET_YES == pc->all) || | 1198 | if ( (GNUNET_YES != pc->all) && |
1208 | (0 == memcmp (peer, &pc->id, sizeof (pc->id))) ) | 1199 | (0 != memcmp (peer, &pc->id, sizeof (pc->id))) ) |
1209 | { | 1200 | return; |
1210 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1201 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1211 | "Sending information about for validation entry for peer `%s' using address `%s'\n", | 1202 | "Sending information about for validation entry for peer `%s' using address `%s'\n", |
1212 | GNUNET_i2s(peer), (address != NULL) ? GST_plugins_a2s (address) : "<none>"); | 1203 | GNUNET_i2s(peer), |
1213 | msg = compose_validation_iterate_response_message (peer, address); | 1204 | (NULL != address) ? GST_plugins_a2s (address) : "<none>"); |
1214 | msg->last_validation = GNUNET_TIME_absolute_hton(last_validation); | 1205 | msg = compose_validation_iterate_response_message (peer, address); |
1215 | msg->valid_until = GNUNET_TIME_absolute_hton(valid_until); | 1206 | msg->last_validation = GNUNET_TIME_absolute_hton(last_validation); |
1216 | msg->next_validation = GNUNET_TIME_absolute_hton(next_validation); | 1207 | msg->valid_until = GNUNET_TIME_absolute_hton(valid_until); |
1217 | msg->state = htonl ((uint32_t) state); | 1208 | msg->next_validation = GNUNET_TIME_absolute_hton(next_validation); |
1218 | GNUNET_SERVER_transmit_context_append_message (pc->tc, &msg->header); | 1209 | msg->state = htonl ((uint32_t) state); |
1219 | GNUNET_free (msg); | 1210 | GNUNET_SERVER_transmit_context_append_message (pc->tc, &msg->header); |
1220 | } | 1211 | GNUNET_free (msg); |
1221 | } | 1212 | } |
1222 | 1213 | ||
1223 | 1214 | ||
@@ -1244,20 +1235,19 @@ send_peer_information (void *cls, | |||
1244 | struct IterationContext *pc = cls; | 1235 | struct IterationContext *pc = cls; |
1245 | struct PeerIterateResponseMessage *msg; | 1236 | struct PeerIterateResponseMessage *msg; |
1246 | 1237 | ||
1247 | if ( (GNUNET_YES == pc->all) || | 1238 | if ( (GNUNET_YES != pc->all) && |
1248 | (0 == memcmp (peer, &pc->id, sizeof (pc->id))) ) | 1239 | (0 != memcmp (peer, &pc->id, sizeof (pc->id))) ) |
1249 | { | 1240 | return; |
1250 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1241 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1251 | "Sending information about `%s' using address `%s' in state `%s'\n", | 1242 | "Sending information about `%s' using address `%s' in state `%s'\n", |
1252 | GNUNET_i2s(peer), | 1243 | GNUNET_i2s(peer), |
1253 | (address != NULL) ? GST_plugins_a2s (address) : "<none>", | 1244 | (NULL != address) ? GST_plugins_a2s (address) : "<none>", |
1254 | GNUNET_TRANSPORT_ps2s (state)); | 1245 | GNUNET_TRANSPORT_ps2s (state)); |
1255 | msg = compose_address_iterate_response_message (peer, address); | 1246 | msg = compose_address_iterate_response_message (peer, address); |
1256 | msg->state = htonl (state); | 1247 | msg->state = htonl (state); |
1257 | msg->state_timeout = GNUNET_TIME_absolute_hton(state_timeout); | 1248 | msg->state_timeout = GNUNET_TIME_absolute_hton(state_timeout); |
1258 | GNUNET_SERVER_transmit_context_append_message (pc->tc, &msg->header); | 1249 | GNUNET_SERVER_transmit_context_append_message (pc->tc, &msg->header); |
1259 | GNUNET_free (msg); | 1250 | GNUNET_free (msg); |
1260 | } | ||
1261 | } | 1251 | } |
1262 | 1252 | ||
1263 | 1253 | ||
@@ -1283,9 +1273,6 @@ clients_handle_monitor_peers (void *cls, | |||
1283 | (NULL != lookup_monitoring_client (peer_monitoring_clients_head, | 1273 | (NULL != lookup_monitoring_client (peer_monitoring_clients_head, |
1284 | client)) ) | 1274 | client)) ) |
1285 | { | 1275 | { |
1286 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | ||
1287 | "ServerClient %p tried to start monitoring twice\n", | ||
1288 | client); | ||
1289 | GNUNET_break (0); | 1276 | GNUNET_break (0); |
1290 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 1277 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
1291 | return; | 1278 | return; |
@@ -1295,7 +1282,9 @@ clients_handle_monitor_peers (void *cls, | |||
1295 | pc.tc = tc = GNUNET_SERVER_transmit_context_create (client); | 1282 | pc.tc = tc = GNUNET_SERVER_transmit_context_create (client); |
1296 | 1283 | ||
1297 | /* Send initial list */ | 1284 | /* Send initial list */ |
1298 | if (0 == memcmp (&msg->peer, &all_zeros, sizeof (struct GNUNET_PeerIdentity))) | 1285 | if (0 == memcmp (&msg->peer, |
1286 | &all_zeros, | ||
1287 | sizeof (struct GNUNET_PeerIdentity))) | ||
1299 | { | 1288 | { |
1300 | /* iterate over all neighbours */ | 1289 | /* iterate over all neighbours */ |
1301 | pc.all = GNUNET_YES; | 1290 | pc.all = GNUNET_YES; |
@@ -1356,9 +1345,6 @@ clients_handle_monitor_validation (void *cls, | |||
1356 | if ( (GNUNET_YES != ntohl (msg->one_shot)) && | 1345 | if ( (GNUNET_YES != ntohl (msg->one_shot)) && |
1357 | (NULL != lookup_monitoring_client (val_monitoring_clients_head, client)) ) | 1346 | (NULL != lookup_monitoring_client (val_monitoring_clients_head, client)) ) |
1358 | { | 1347 | { |
1359 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | ||
1360 | "ServerClient %p tried to start monitoring twice\n", | ||
1361 | client); | ||
1362 | GNUNET_break (0); | 1348 | GNUNET_break (0); |
1363 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 1349 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
1364 | return; | 1350 | return; |
@@ -1368,7 +1354,9 @@ clients_handle_monitor_validation (void *cls, | |||
1368 | pc.tc = tc = GNUNET_SERVER_transmit_context_create (client); | 1354 | pc.tc = tc = GNUNET_SERVER_transmit_context_create (client); |
1369 | 1355 | ||
1370 | /* Send initial list */ | 1356 | /* Send initial list */ |
1371 | if (0 == memcmp (&msg->peer, &all_zeros, sizeof (struct GNUNET_PeerIdentity))) | 1357 | if (0 == memcmp (&msg->peer, |
1358 | &all_zeros, | ||
1359 | sizeof (struct GNUNET_PeerIdentity))) | ||
1372 | { | 1360 | { |
1373 | /* iterate over all neighbours */ | 1361 | /* iterate over all neighbours */ |
1374 | pc.all = GNUNET_YES; | 1362 | pc.all = GNUNET_YES; |
@@ -1380,8 +1368,8 @@ clients_handle_monitor_validation (void *cls, | |||
1380 | pc.all = GNUNET_NO; | 1368 | pc.all = GNUNET_NO; |
1381 | pc.id = msg->peer; | 1369 | pc.id = msg->peer; |
1382 | } | 1370 | } |
1383 | 1371 | GST_validation_iterate (&send_validation_information, | |
1384 | GST_validation_iterate (&send_validation_information, &pc); | 1372 | &pc); |
1385 | 1373 | ||
1386 | if (GNUNET_YES != ntohl (msg->one_shot)) | 1374 | if (GNUNET_YES != ntohl (msg->one_shot)) |
1387 | { | 1375 | { |
@@ -1390,7 +1378,7 @@ clients_handle_monitor_validation (void *cls, | |||
1390 | else | 1378 | else |
1391 | { | 1379 | { |
1392 | GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0, | 1380 | GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0, |
1393 | GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_VALIDATION_RESPONSE); | 1381 | GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_VALIDATION_RESPONSE); |
1394 | } | 1382 | } |
1395 | GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL); | 1383 | GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL); |
1396 | } | 1384 | } |
@@ -1653,23 +1641,19 @@ GST_clients_broadcast_peer_notification (const struct GNUNET_PeerIdentity *peer, | |||
1653 | msg = compose_address_iterate_response_message (peer, address); | 1641 | msg = compose_address_iterate_response_message (peer, address); |
1654 | msg->state = htonl (state); | 1642 | msg->state = htonl (state); |
1655 | msg->state_timeout = GNUNET_TIME_absolute_hton (state_timeout); | 1643 | msg->state_timeout = GNUNET_TIME_absolute_hton (state_timeout); |
1656 | mc = peer_monitoring_clients_head; | 1644 | for (mc = peer_monitoring_clients_head; NULL != mc; mc = mc->next) |
1657 | while (mc != NULL) | ||
1658 | { | ||
1659 | if ((0 == memcmp (&mc->peer, &all_zeros, | 1645 | if ((0 == memcmp (&mc->peer, &all_zeros, |
1660 | sizeof (struct GNUNET_PeerIdentity))) || | 1646 | sizeof (struct GNUNET_PeerIdentity))) || |
1661 | (0 == memcmp (&mc->peer, peer, | 1647 | (0 == memcmp (&mc->peer, peer, |
1662 | sizeof (struct GNUNET_PeerIdentity)))) | 1648 | sizeof (struct GNUNET_PeerIdentity)))) |
1663 | { | 1649 | GNUNET_SERVER_notification_context_unicast (peer_nc, |
1664 | GNUNET_SERVER_notification_context_unicast (peer_nc, mc->client, | 1650 | mc->client, |
1665 | &msg->header, GNUNET_NO); | 1651 | &msg->header, |
1666 | } | 1652 | GNUNET_NO); |
1667 | |||
1668 | mc = mc->next; | ||
1669 | } | ||
1670 | GNUNET_free (msg); | 1653 | GNUNET_free (msg); |
1671 | } | 1654 | } |
1672 | 1655 | ||
1656 | |||
1673 | /** | 1657 | /** |
1674 | * Broadcast the new validation changes to all clients monitoring the peer. | 1658 | * Broadcast the new validation changes to all clients monitoring the peer. |
1675 | * | 1659 | * |
@@ -1693,27 +1677,22 @@ GST_clients_broadcast_validation_notification (const struct GNUNET_PeerIdentity | |||
1693 | 1677 | ||
1694 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1678 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1695 | "Sending information about for validation entry for peer `%s' using address `%s'\n", | 1679 | "Sending information about for validation entry for peer `%s' using address `%s'\n", |
1696 | GNUNET_i2s(peer), (address != NULL) ? GST_plugins_a2s (address) : "<none>"); | 1680 | GNUNET_i2s(peer), |
1697 | 1681 | (address != NULL) ? GST_plugins_a2s (address) : "<none>"); | |
1698 | msg = compose_validation_iterate_response_message (peer, address); | 1682 | msg = compose_validation_iterate_response_message (peer, address); |
1699 | msg->last_validation = GNUNET_TIME_absolute_hton(last_validation); | 1683 | msg->last_validation = GNUNET_TIME_absolute_hton(last_validation); |
1700 | msg->valid_until = GNUNET_TIME_absolute_hton(valid_until); | 1684 | msg->valid_until = GNUNET_TIME_absolute_hton(valid_until); |
1701 | msg->next_validation = GNUNET_TIME_absolute_hton(next_validation); | 1685 | msg->next_validation = GNUNET_TIME_absolute_hton(next_validation); |
1702 | msg->state = htonl ((uint32_t) state); | 1686 | msg->state = htonl ((uint32_t) state); |
1703 | mc = val_monitoring_clients_head; | 1687 | for (mc = val_monitoring_clients_head; NULL != mc; mc = mc->next) |
1704 | while (mc != NULL) | ||
1705 | { | ||
1706 | if ((0 == memcmp (&mc->peer, &all_zeros, | 1688 | if ((0 == memcmp (&mc->peer, &all_zeros, |
1707 | sizeof (struct GNUNET_PeerIdentity))) || | 1689 | sizeof (struct GNUNET_PeerIdentity))) || |
1708 | (0 == memcmp (&mc->peer, peer, | 1690 | (0 == memcmp (&mc->peer, peer, |
1709 | sizeof (struct GNUNET_PeerIdentity)))) | 1691 | sizeof (struct GNUNET_PeerIdentity)))) |
1710 | { | 1692 | GNUNET_SERVER_notification_context_unicast (val_nc, |
1711 | GNUNET_SERVER_notification_context_unicast (val_nc, mc->client, | 1693 | mc->client, |
1712 | &msg->header, GNUNET_NO); | 1694 | &msg->header, |
1713 | 1695 | GNUNET_NO); | |
1714 | } | ||
1715 | mc = mc->next; | ||
1716 | } | ||
1717 | GNUNET_free (msg); | 1696 | GNUNET_free (msg); |
1718 | } | 1697 | } |
1719 | 1698 | ||