aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-01-08 10:50:27 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-01-08 10:50:27 +0000
commit0db0f5b8f69e2137256904edf29222e71051e77c (patch)
tree490944a3362d95c412c3d26f034a229c8e106676 /src
parentf98fb14e5a1c4acc0444d9c78c654468fab02c6a (diff)
downloadgnunet-0db0f5b8f69e2137256904edf29222e71051e77c.tar.gz
gnunet-0db0f5b8f69e2137256904edf29222e71051e77c.zip
implementing monitoring api
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_protocols.h21
-rw-r--r--src/include/gnunet_transport_service.h17
-rw-r--r--src/transport/Makefile.am1
-rw-r--r--src/transport/gnunet-service-transport_clients.c102
-rw-r--r--src/transport/gnunet-service-transport_neighbours.c120
-rw-r--r--src/transport/gnunet-service-transport_neighbours.h12
-rw-r--r--src/transport/transport.h2
-rw-r--r--src/transport/transport_api_monitoring.c128
8 files changed, 240 insertions, 163 deletions
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index e2923b971..1861c318b 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -1278,7 +1278,7 @@ extern "C"
1278/** 1278/**
1279 * Request to monitor addresses used by a peer or all peers. 1279 * Request to monitor addresses used by a peer or all peers.
1280 */ 1280 */
1281#define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE 380 1281#define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST 380
1282 1282
1283/** 1283/**
1284 * Message send by a peer to notify the other to keep the session alive 1284 * Message send by a peer to notify the other to keep the session alive
@@ -1287,16 +1287,16 @@ extern "C"
1287#define GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE 381 1287#define GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE 381
1288 1288
1289/** 1289/**
1290 * Response to a GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE message to 1290 * Response to a #GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE message to
1291 * measure latency in a regular interval 1291 * measure latency in a regular interval
1292 */ 1292 */
1293#define GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE 382 1293#define GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_KEEPALIVE_RESPONSE 382
1294 1294
1295
1296/** 1295/**
1297 * Request to iterate over all known addresses. 1296 * Response to #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST
1297 * request to iterate over all known addresses.
1298 */ 1298 */
1299#define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE 383 1299#define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE 383
1300 1300
1301/** 1301/**
1302 * Message send by a peer to notify the other to keep the session alive. 1302 * Message send by a peer to notify the other to keep the session alive.
@@ -1308,6 +1308,17 @@ extern "C"
1308 */ 1308 */
1309#define GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC 385 1309#define GNUNET_MESSAGE_TYPE_TRANSPORT_TRAFFIC_METRIC 385
1310 1310
1311/**
1312 * Request to monitor address validations by a peer or all peers.
1313 */
1314#define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_VALIDATION_REQUEST 386
1315
1316/**
1317 * Response to #GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_VALIDATION_REQUEST
1318 * request to iterate over all known addresses.
1319 */
1320#define GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_VALIDATION_RESPONSE 387
1321
1311 1322
1312 1323
1313/******************************************************************************* 1324/*******************************************************************************
diff --git a/src/include/gnunet_transport_service.h b/src/include/gnunet_transport_service.h
index dee8e7118..5448460ad 100644
--- a/src/include/gnunet_transport_service.h
+++ b/src/include/gnunet_transport_service.h
@@ -587,6 +587,23 @@ GNUNET_TRANSPORT_address_to_string_cancel (struct
587 GNUNET_TRANSPORT_AddressToStringContext 587 GNUNET_TRANSPORT_AddressToStringContext
588 *pic); 588 *pic);
589 589
590/**
591 * Convert a transport state to a human readable string.
592 *
593 * @param alc handle for the request to cancel
594 */
595const char *
596GNUNET_TRANSPORT_p2s (enum GNUNET_TRANSPORT_PeerState state);
597
598
599/**
600 * Check if a state is defined as connected
601 *
602 * @param state the state value
603 * @return GNUNET_YES or GNUNET_NO
604 */
605int
606GNUNET_TRANSPORT_is_connected (enum GNUNET_TRANSPORT_PeerState state);
590 607
591/** 608/**
592 * Return information about a specific peer or all peers currently known to 609 * Return information about a specific peer or all peers currently known to
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index 1221cdbea..9851a7907 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -210,6 +210,7 @@ gnunet_service_transport_SOURCES = \
210 gnunet-service-transport_validation.h gnunet-service-transport_validation.c \ 210 gnunet-service-transport_validation.h gnunet-service-transport_validation.c \
211 gnunet-service-transport_manipulation.h gnunet-service-transport_manipulation.c 211 gnunet-service-transport_manipulation.h gnunet-service-transport_manipulation.c
212gnunet_service_transport_LDADD = \ 212gnunet_service_transport_LDADD = \
213 $(top_builddir)/src/transport/libgnunettransport.la \
213 $(top_builddir)/src/ats/libgnunetats.la \ 214 $(top_builddir)/src/ats/libgnunetats.la \
214 $(top_builddir)/src/hello/libgnunethello.la \ 215 $(top_builddir)/src/hello/libgnunethello.la \
215 $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \ 216 $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index 7c4a9d712..6bd3e34d5 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -468,16 +468,21 @@ client_disconnect_notification (void *cls, struct GNUNET_SERVER_Client *client)
468 */ 468 */
469static void 469static void
470notify_client_about_neighbour (void *cls, 470notify_client_about_neighbour (void *cls,
471 const struct GNUNET_PeerIdentity *peer, 471 const struct GNUNET_PeerIdentity *peer,
472 const struct GNUNET_HELLO_Address *address, 472 const struct GNUNET_HELLO_Address *address,
473 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 473 enum GNUNET_TRANSPORT_PeerState state,
474 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) 474 struct GNUNET_TIME_Absolute state_timeout,
475 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
476 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
475{ 477{
476 struct TransportClient *tc = cls; 478 struct TransportClient *tc = cls;
477 struct ConnectInfoMessage *cim; 479 struct ConnectInfoMessage *cim;
478 size_t size = sizeof (struct ConnectInfoMessage); 480 size_t size = sizeof (struct ConnectInfoMessage);
479 char buf[size] GNUNET_ALIGN; 481 char buf[size] GNUNET_ALIGN;
480 482
483 if (GNUNET_NO == GST_neighbours_test_connected (peer))
484 return;
485
481 GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE); 486 GNUNET_assert (size < GNUNET_SERVER_MAX_MESSAGE_SIZE);
482 cim = (struct ConnectInfoMessage *) buf; 487 cim = (struct ConnectInfoMessage *) buf;
483 cim->header.size = htons (size); 488 cim->header.size = htons (size);
@@ -873,7 +878,7 @@ compose_address_iterate_response_message (const struct GNUNET_PeerIdentity *peer
873 msg = GNUNET_malloc (size); 878 msg = GNUNET_malloc (size);
874 msg->header.size = htons (size); 879 msg->header.size = htons (size);
875 msg->header.type = 880 msg->header.type =
876 htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE); 881 htons (GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE);
877 msg->reserved = htonl (0); 882 msg->reserved = htonl (0);
878 msg->peer = *peer; 883 msg->peer = *peer;
879 msg->addrlen = htonl (alen); 884 msg->addrlen = htonl (alen);
@@ -888,33 +893,55 @@ compose_address_iterate_response_message (const struct GNUNET_PeerIdentity *peer
888} 893}
889 894
890 895
896struct PeerIterationContext
897{
898 struct GNUNET_SERVER_TransmitContext *tc;
899
900 struct GNUNET_PeerIdentity id;
901
902 int all;
903};
904
891/** 905/**
892 * Output the active address of connected neighbours to the given client. 906 * Output information of neighbours to the given client.
893 * 907 *
894 * @param cls the 'struct GNUNET_SERVER_TransmitContext' for transmission to the client 908 * @param cls the 'struct PeerIterationContext'
895 * @param peer identity of the neighbour 909 * @param peer identity of the neighbour
896 * @param address the address 910 * @param address the address
897 * @param bandwidth_in inbound quota in NBO 911 * @param bandwidth_in inbound quota in NBO
898 * @param bandwidth_out outbound quota in NBO 912 * @param bandwidth_out outbound quota in NBO
899 */ 913 */
900static void 914static void
901output_address (void *cls, const struct GNUNET_PeerIdentity *peer, 915send_peer_information (void *cls,
902 const struct GNUNET_HELLO_Address *address, 916 const struct GNUNET_PeerIdentity *peer,
903 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 917 const struct GNUNET_HELLO_Address *address,
904 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out) 918 enum GNUNET_TRANSPORT_PeerState state,
919 struct GNUNET_TIME_Absolute state_timeout,
920 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
921 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out)
905{ 922{
906 struct GNUNET_SERVER_TransmitContext *tc = cls; 923 struct PeerIterationContext *pc = cls;
907 struct PeerIterateResponseMessage *msg; 924 struct PeerIterateResponseMessage *msg;
908 925
909 msg = compose_address_iterate_response_message (peer, address); 926 if ( (GNUNET_YES == pc->all) ||
910 GNUNET_SERVER_transmit_context_append_message (tc, &msg->header); 927 (0 == memcmp (peer, &pc->id, sizeof (pc->id))) )
911 GNUNET_free (msg); 928 {
929 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
930 "Sending information about `%s' using address `%s' in state `%s'\n",
931 GNUNET_i2s(peer), address);
932 msg = compose_address_iterate_response_message (peer, address);
933 msg->state = htonl (state);
934 msg->state_timeout = GNUNET_TIME_absolute_hton(state_timeout);
935 GNUNET_SERVER_transmit_context_append_message (pc->tc, &msg->header);
936 GNUNET_free (msg);
937 }
912} 938}
913 939
914 940
941
942
915/** 943/**
916 * Client asked to obtain information about all actively used addresses 944 * Client asked to obtain information about a specific or all peers
917 * of connected peers
918 * Process the request. 945 * Process the request.
919 * 946 *
920 * @param cls unused 947 * @param cls unused
@@ -922,27 +949,27 @@ output_address (void *cls, const struct GNUNET_PeerIdentity *peer,
922 * @param message the peer address information request 949 * @param message the peer address information request
923 */ 950 */
924static void 951static void
925clients_handle_address_iterate (void *cls, struct GNUNET_SERVER_Client *client, 952clients_handle_monitor_peers (void *cls, struct GNUNET_SERVER_Client *client,
926 const struct GNUNET_MessageHeader *message) 953 const struct GNUNET_MessageHeader *message)
927{ 954{
928 static struct GNUNET_PeerIdentity all_zeros; 955 static struct GNUNET_PeerIdentity all_zeros;
929 struct GNUNET_SERVER_TransmitContext *tc; 956 struct GNUNET_SERVER_TransmitContext *tc;
930 struct PeerIterateMessage *msg; 957 struct PeerMonitorMessage *msg;
931 struct GNUNET_HELLO_Address *address; 958 struct PeerIterationContext pc;
932 959
933 if (ntohs (message->type) != GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE) 960 if (ntohs (message->type) != GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST)
934 { 961 {
935 GNUNET_break (0); 962 GNUNET_break (0);
936 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 963 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
937 return; 964 return;
938 } 965 }
939 if (ntohs (message->size) != sizeof (struct PeerIterateMessage)) 966 if (ntohs (message->size) != sizeof (struct PeerMonitorMessage))
940 { 967 {
941 GNUNET_break (0); 968 GNUNET_break (0);
942 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 969 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
943 return; 970 return;
944 } 971 }
945 msg = (struct PeerIterateMessage *) message; 972 msg = (struct PeerMonitorMessage *) message;
946 if ( (GNUNET_YES != ntohl (msg->one_shot)) && 973 if ( (GNUNET_YES != ntohl (msg->one_shot)) &&
947 (NULL != lookup_monitoring_client (client)) ) 974 (NULL != lookup_monitoring_client (client)) )
948 { 975 {
@@ -954,26 +981,33 @@ clients_handle_address_iterate (void *cls, struct GNUNET_SERVER_Client *client,
954 return; 981 return;
955 } 982 }
956 GNUNET_SERVER_disable_receive_done_warning (client); 983 GNUNET_SERVER_disable_receive_done_warning (client);
957 tc = GNUNET_SERVER_transmit_context_create (client); 984 pc.tc = tc = GNUNET_SERVER_transmit_context_create (client);
985
986 /* Send initial list */
958 if (0 == memcmp (&msg->peer, &all_zeros, sizeof (struct GNUNET_PeerIdentity))) 987 if (0 == memcmp (&msg->peer, &all_zeros, sizeof (struct GNUNET_PeerIdentity)))
959 { 988 {
960 /* iterate over all neighbours */ 989 /* iterate over all neighbours */
961 GST_neighbours_iterate (&output_address, tc); 990 pc.all = GNUNET_YES;
991 pc.id = msg->peer;
962 } 992 }
963 else 993 else
964 { 994 {
965 /* just return one neighbour */ 995 /* just return one neighbour */
966 address = GST_neighbour_get_current_address (&msg->peer); 996 pc.all = GNUNET_NO;
967 if (address != NULL) 997 pc.id = msg->peer;
968 output_address (tc, &msg->peer, address,
969 GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT,
970 GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT);
971 } 998 }
999 GST_neighbours_iterate (&send_peer_information, &pc);
1000
972 if (GNUNET_YES != ntohl (msg->one_shot)) 1001 if (GNUNET_YES != ntohl (msg->one_shot))
1002 {
973 setup_monitoring_client (client, &msg->peer); 1003 setup_monitoring_client (client, &msg->peer);
1004 }
974 else 1005 else
1006 {
975 GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0, 1007 GNUNET_SERVER_transmit_context_append_data (tc, NULL, 0,
976 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE); 1008 GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE);
1009 }
1010
977 GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL); 1011 GNUNET_SERVER_transmit_context_run (tc, GNUNET_TIME_UNIT_FOREVER_REL);
978} 1012}
979 1013
@@ -998,9 +1032,9 @@ GST_clients_start (struct GNUNET_SERVER_Handle *server)
998 sizeof (struct TransportRequestConnectMessage)}, 1032 sizeof (struct TransportRequestConnectMessage)},
999 {&clients_handle_address_to_string, NULL, 1033 {&clients_handle_address_to_string, NULL,
1000 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING, 0}, 1034 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_TO_STRING, 0},
1001 {&clients_handle_address_iterate, NULL, 1035 {&clients_handle_monitor_peers, NULL,
1002 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE, 1036 GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST,
1003 sizeof (struct PeerIterateMessage)}, 1037 sizeof (struct PeerMonitorMessage)},
1004 {&GST_blacklist_handle_init, NULL, 1038 {&GST_blacklist_handle_init, NULL,
1005 GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_INIT, 1039 GNUNET_MESSAGE_TYPE_TRANSPORT_BLACKLIST_INIT,
1006 sizeof (struct GNUNET_MessageHeader)}, 1040 sizeof (struct GNUNET_MessageHeader)},
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c
index d451991f1..7d7d1f7e3 100644
--- a/src/transport/gnunet-service-transport_neighbours.c
+++ b/src/transport/gnunet-service-transport_neighbours.c
@@ -514,55 +514,6 @@ lookup_neighbour (const struct GNUNET_PeerIdentity *pid)
514 514
515 515
516/** 516/**
517 * Convert state to human-readable string.
518 *
519 * @param state the state value
520 * @return corresponding string
521 */
522static const char *
523print_state (enum GNUNET_TRANSPORT_PeerState state)
524{
525 switch (state)
526 {
527 case S_NOT_CONNECTED:
528 return "S_NOT_CONNECTED";
529 case S_INIT_ATS:
530 return "S_INIT_ATS";
531 case S_INIT_BLACKLIST:
532 return "S_INIT_BLACKLIST";
533 case S_CONNECT_SENT:
534 return "S_CONNECT_SENT";
535 case S_CONNECT_RECV_BLACKLIST_INBOUND:
536 return "S_CONNECT_RECV_BLACKLIST_INBOUND";
537 case S_CONNECT_RECV_ATS:
538 return "S_CONNECT_RECV_ATS";
539 case S_CONNECT_RECV_BLACKLIST:
540 return "S_CONNECT_RECV_BLACKLIST";
541 case S_CONNECT_RECV_ACK:
542 return "S_CONNECT_RECV_ACK";
543 case S_CONNECTED:
544 return "S_CONNECTED";
545 case S_RECONNECT_ATS:
546 return "S_RECONNECT_ATS";
547 case S_RECONNECT_BLACKLIST:
548 return "S_RECONNECT_BLACKLIST";
549 case S_RECONNECT_SENT:
550 return "S_RECONNECT_SENT";
551 case S_CONNECTED_SWITCHING_BLACKLIST:
552 return "S_CONNECTED_SWITCHING_BLACKLIST";
553 case S_CONNECTED_SWITCHING_CONNECT_SENT:
554 return "S_CONNECTED_SWITCHING_CONNECT_SENT";
555 case S_DISCONNECT:
556 return "S_DISCONNECT";
557 case S_DISCONNECT_FINISHED:
558 return "S_DISCONNECT_FINISHED";
559 default:
560 GNUNET_break (0);
561 return "UNDEFINED";
562 }
563}
564
565/**
566 * Test if we're connected to the given peer. 517 * Test if we're connected to the given peer.
567 * 518 *
568 * @param n neighbour entry of peer to test 519 * @param n neighbour entry of peer to test
@@ -573,35 +524,7 @@ test_connected (struct NeighbourMapEntry *n)
573{ 524{
574 if (NULL == n) 525 if (NULL == n)
575 return GNUNET_NO; 526 return GNUNET_NO;
576 switch (n->state) 527 return GNUNET_TRANSPORT_is_connected (n->state);
577 {
578 case S_NOT_CONNECTED:
579 case S_INIT_ATS:
580 case S_INIT_BLACKLIST:
581 case S_CONNECT_SENT:
582 case S_CONNECT_RECV_BLACKLIST_INBOUND:
583 case S_CONNECT_RECV_ATS:
584 case S_CONNECT_RECV_BLACKLIST:
585 case S_CONNECT_RECV_ACK:
586 return GNUNET_NO;
587 case S_CONNECTED:
588 case S_RECONNECT_ATS:
589 case S_RECONNECT_BLACKLIST:
590 case S_RECONNECT_SENT:
591 case S_CONNECTED_SWITCHING_BLACKLIST:
592 case S_CONNECTED_SWITCHING_CONNECT_SENT:
593 return GNUNET_YES;
594 case S_DISCONNECT:
595 case S_DISCONNECT_FINISHED:
596 return GNUNET_NO;
597 default:
598 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
599 "Unhandled state `%s' \n",
600 print_state (n->state));
601 GNUNET_break (0);
602 break;
603 }
604 return GNUNET_SYSERR;
605} 528}
606 529
607/** 530/**
@@ -960,7 +883,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
960 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 883 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
961 "Disconnecting from peer %s in state %s\n", 884 "Disconnecting from peer %s in state %s\n",
962 GNUNET_i2s (&n->id), 885 GNUNET_i2s (&n->id),
963 print_state (n->state)); 886 GNUNET_TRANSPORT_p2s (n->state));
964 /* depending on state, notify neighbour and/or upper layers of this peer 887 /* depending on state, notify neighbour and/or upper layers of this peer
965 about disconnect */ 888 about disconnect */
966 switch (n->state) 889 switch (n->state)
@@ -1022,7 +945,7 @@ disconnect_neighbour (struct NeighbourMapEntry *n)
1022 default: 945 default:
1023 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 946 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1024 "Unhandled state `%s'\n", 947 "Unhandled state `%s'\n",
1025 print_state (n->state)); 948 GNUNET_TRANSPORT_p2s (n->state));
1026 GNUNET_break (0); 949 GNUNET_break (0);
1027 break; 950 break;
1028 } 951 }
@@ -1693,7 +1616,7 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target)
1693 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1616 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1694 "Asked to connect to peer `%s' (state: %s)\n", 1617 "Asked to connect to peer `%s' (state: %s)\n",
1695 GNUNET_i2s (target), 1618 GNUNET_i2s (target),
1696 (NULL != n) ? print_state(n->state) : "NEW PEER"); 1619 (NULL != n) ? GNUNET_TRANSPORT_p2s(n->state) : "NEW PEER");
1697 if (NULL != n) 1620 if (NULL != n)
1698 { 1621 {
1699 switch (n->state) 1622 switch (n->state)
@@ -1734,7 +1657,7 @@ GST_neighbours_try_connect (const struct GNUNET_PeerIdentity *target)
1734 default: 1657 default:
1735 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1658 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1736 "Unhandled state `%s'\n", 1659 "Unhandled state `%s'\n",
1737 print_state (n->state)); 1660 GNUNET_TRANSPORT_p2s (n->state));
1738 GNUNET_break (0); 1661 GNUNET_break (0);
1739 free_neighbour (n, GNUNET_NO); 1662 free_neighbour (n, GNUNET_NO);
1740 break; 1663 break;
@@ -1795,7 +1718,7 @@ handle_test_blacklist_cont (void *cls,
1795 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1718 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1796 "Received blacklist result for peer `%s' in state %s/%d\n", 1719 "Received blacklist result for peer `%s' in state %s/%d\n",
1797 GNUNET_i2s (peer), 1720 GNUNET_i2s (peer),
1798 print_state (n->state), 1721 GNUNET_TRANSPORT_p2s (n->state),
1799 n->send_connect_ack); 1722 n->send_connect_ack);
1800 switch (n->state) 1723 switch (n->state)
1801 { 1724 {
@@ -1992,7 +1915,7 @@ handle_test_blacklist_cont (void *cls,
1992 default: 1915 default:
1993 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1916 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1994 "Unhandled state `%s'\n", 1917 "Unhandled state `%s'\n",
1995 print_state (n->state)); 1918 GNUNET_TRANSPORT_p2s (n->state));
1996 GNUNET_break (0); 1919 GNUNET_break (0);
1997 free_neighbour (n, GNUNET_NO); 1920 free_neighbour (n, GNUNET_NO);
1998 break; 1921 break;
@@ -2093,7 +2016,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
2093 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2016 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2094 "Received SESSION_CONNECT for peer `%s' in state %s/%d\n", 2017 "Received SESSION_CONNECT for peer `%s' in state %s/%d\n",
2095 GNUNET_i2s (peer), 2018 GNUNET_i2s (peer),
2096 print_state (n->state), 2019 GNUNET_TRANSPORT_p2s (n->state),
2097 n->send_connect_ack); 2020 n->send_connect_ack);
2098 switch (n->state) 2021 switch (n->state)
2099 { 2022 {
@@ -2161,7 +2084,7 @@ GST_neighbours_handle_connect (const struct GNUNET_MessageHeader *message,
2161 default: 2084 default:
2162 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2085 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2163 "Unhandled state `%s'\n", 2086 "Unhandled state `%s'\n",
2164 print_state (n->state)); 2087 GNUNET_TRANSPORT_p2s (n->state));
2165 GNUNET_break (0); 2088 GNUNET_break (0);
2166 return GNUNET_SYSERR; 2089 return GNUNET_SYSERR;
2167 } 2090 }
@@ -2234,7 +2157,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
2234 address->transport_name, 2157 address->transport_name,
2235 session, 2158 session,
2236 GNUNET_i2s (peer), 2159 GNUNET_i2s (peer),
2237 print_state (n->state), 2160 GNUNET_TRANSPORT_p2s (n->state),
2238 n->send_connect_ack, 2161 n->send_connect_ack,
2239 ntohl (bandwidth_in.value__), 2162 ntohl (bandwidth_in.value__),
2240 ntohl (bandwidth_out.value__)); 2163 ntohl (bandwidth_out.value__));
@@ -2404,7 +2327,7 @@ GST_neighbours_switch_to_address (const struct GNUNET_PeerIdentity *peer,
2404 default: 2327 default:
2405 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2328 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2406 "Unhandled state `%s'\n", 2329 "Unhandled state `%s'\n",
2407 print_state (n->state)); 2330 GNUNET_TRANSPORT_p2s (n->state));
2408 GNUNET_break (0); 2331 GNUNET_break (0);
2409 break; 2332 break;
2410 } 2333 }
@@ -2571,7 +2494,7 @@ master_task (void *cls,
2571 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2494 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2572 "Master task runs for neighbour `%s' in state %s with timeout in %s\n", 2495 "Master task runs for neighbour `%s' in state %s with timeout in %s\n",
2573 GNUNET_i2s (&n->id), 2496 GNUNET_i2s (&n->id),
2574 print_state(n->state), 2497 GNUNET_TRANSPORT_p2s(n->state),
2575 GNUNET_STRINGS_relative_time_to_string (delay, 2498 GNUNET_STRINGS_relative_time_to_string (delay,
2576 GNUNET_YES)); 2499 GNUNET_YES));
2577 switch (n->state) 2500 switch (n->state)
@@ -2742,7 +2665,7 @@ master_task (void *cls,
2742 default: 2665 default:
2743 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2666 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2744 "Unhandled state `%s'\n", 2667 "Unhandled state `%s'\n",
2745 print_state (n->state)); 2668 GNUNET_TRANSPORT_p2s (n->state));
2746 GNUNET_break (0); 2669 GNUNET_break (0);
2747 break; 2670 break;
2748 } 2671 }
@@ -2930,7 +2853,7 @@ GST_neighbours_handle_connect_ack (const struct GNUNET_MessageHeader *message,
2930 default: 2853 default:
2931 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2854 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2932 "Unhandled state `%s'\n", 2855 "Unhandled state `%s'\n",
2933 print_state (n->state)); 2856 GNUNET_TRANSPORT_p2s (n->state));
2934 GNUNET_break (0); 2857 GNUNET_break (0);
2935 return GNUNET_SYSERR; 2858 return GNUNET_SYSERR;
2936 } 2859 }
@@ -3060,7 +2983,7 @@ GST_neighbours_session_terminated (const struct GNUNET_PeerIdentity *peer,
3060 default: 2983 default:
3061 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2984 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3062 "Unhandled state `%s'\n", 2985 "Unhandled state `%s'\n",
3063 print_state (n->state)); 2986 GNUNET_TRANSPORT_p2s (n->state));
3064 GNUNET_break (0); 2987 GNUNET_break (0);
3065 break; 2988 break;
3066 } 2989 }
@@ -3117,7 +3040,7 @@ GST_neighbours_handle_session_ack (const struct GNUNET_MessageHeader *message,
3117 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3040 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3118 "Received SESSION_ACK message from peer `%s' in state %s/%d\n", 3041 "Received SESSION_ACK message from peer `%s' in state %s/%d\n",
3119 GNUNET_i2s (peer), 3042 GNUNET_i2s (peer),
3120 print_state (n->state), 3043 GNUNET_TRANSPORT_p2s (n->state),
3121 n->send_connect_ack); 3044 n->send_connect_ack);
3122 GNUNET_STATISTICS_update (GST_stats, 3045 GNUNET_STATISTICS_update (GST_stats,
3123 gettext_noop ("# unexpected SESSION_ACK messages"), 1, 3046 gettext_noop ("# unexpected SESSION_ACK messages"), 1,
@@ -3297,7 +3220,7 @@ struct IteratorContext
3297 3220
3298 3221
3299/** 3222/**
3300 * Call the callback from the closure for each connected neighbour. 3223 * Call the callback from the closure for each neighbour.
3301 * 3224 *
3302 * @param cls the `struct IteratorContext` 3225 * @param cls the `struct IteratorContext`
3303 * @param key the hash of the public key of the neighbour 3226 * @param key the hash of the public key of the neighbour
@@ -3314,8 +3237,6 @@ neighbours_iterate (void *cls,
3314 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in; 3237 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in;
3315 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out; 3238 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out;
3316 3239
3317 if (GNUNET_YES != test_connected (n))
3318 return GNUNET_OK;
3319 3240
3320 if (NULL != n->primary_address.address) 3241 if (NULL != n->primary_address.address)
3321 { 3242 {
@@ -3327,8 +3248,11 @@ neighbours_iterate (void *cls,
3327 bandwidth_in = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; 3248 bandwidth_in = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT;
3328 bandwidth_out = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT; 3249 bandwidth_out = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT;
3329 } 3250 }
3330 ic->cb (ic->cb_cls, &n->id, 3251 ic->cb (ic->cb_cls,
3252 &n->id,
3331 n->primary_address.address, 3253 n->primary_address.address,
3254 n->state,
3255 n->timeout,
3332 bandwidth_in, bandwidth_out); 3256 bandwidth_in, bandwidth_out);
3333 return GNUNET_OK; 3257 return GNUNET_OK;
3334} 3258}
@@ -3415,7 +3339,7 @@ GST_neighbour_get_latency (const struct GNUNET_PeerIdentity *peer)
3415 default: 3339 default:
3416 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 3340 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3417 "Unhandled state `%s'\n", 3341 "Unhandled state `%s'\n",
3418 print_state (n->state)); 3342 GNUNET_TRANSPORT_p2s (n->state));
3419 GNUNET_break (0); 3343 GNUNET_break (0);
3420 break; 3344 break;
3421 } 3345 }
diff --git a/src/transport/gnunet-service-transport_neighbours.h b/src/transport/gnunet-service-transport_neighbours.h
index c72b298c5..2e0e4e692 100644
--- a/src/transport/gnunet-service-transport_neighbours.h
+++ b/src/transport/gnunet-service-transport_neighbours.h
@@ -170,19 +170,21 @@ GST_neighbours_force_disconnect (const struct GNUNET_PeerIdentity *target);
170 170
171 171
172/** 172/**
173 * Function called for each connected neighbour. 173 * Function called for each neighbour.
174 * 174 *
175 * @param cls closure 175 * @param cls closure
176 * @param neighbour identity of the neighbour 176 * @param neighbour identity of the neighbour
177 * @param address the address (or NULL) 177 * @param address the address (or NULL)
178 * @param state current state the peer is in
179 * @param state_timeout timeout for this state
178 * @param bandwidth_in inbound quota in NBO 180 * @param bandwidth_in inbound quota in NBO
179 * @param bandwidth_out outbound quota in NBO 181 * @param bandwidth_out outbound quota in NBO
180 */ 182 */
181typedef void (*GST_NeighbourIterator) (void *cls, 183typedef void (*GST_NeighbourIterator) (void *cls,
182 const struct GNUNET_PeerIdentity * 184 const struct GNUNET_PeerIdentity *neighbour,
183 neighbour, 185 const struct GNUNET_HELLO_Address *address,
184 const struct GNUNET_HELLO_Address * 186 enum GNUNET_TRANSPORT_PeerState state,
185 address, 187 struct GNUNET_TIME_Absolute state_timeout,
186 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 188 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
187 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out); 189 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out);
188 190
diff --git a/src/transport/transport.h b/src/transport/transport.h
index 75cdd729c..43504ec2b 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -375,7 +375,7 @@ struct PeerLookupMessage
375 * Message from the library to the transport service 375 * Message from the library to the transport service
376 * asking for binary addresses known for a peer. 376 * asking for binary addresses known for a peer.
377 */ 377 */
378struct PeerIterateMessage 378struct PeerMonitorMessage
379{ 379{
380 /** 380 /**
381 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE 381 * Type will be GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE
diff --git a/src/transport/transport_api_monitoring.c b/src/transport/transport_api_monitoring.c
index d7bc56e09..bfbe1d0a1 100644
--- a/src/transport/transport_api_monitoring.c
+++ b/src/transport/transport_api_monitoring.c
@@ -140,6 +140,94 @@ struct GNUNET_TRANSPORT_ValidationMonitoringContext
140 int one_shot; 140 int one_shot;
141}; 141};
142 142
143/**
144 * Check if a state is defined as connected
145 *
146 * @param state the state value
147 * @return GNUNET_YES or GNUNET_NO
148 */
149int
150GNUNET_TRANSPORT_is_connected (enum GNUNET_TRANSPORT_PeerState state)
151{
152 switch (state)
153 {
154 case S_NOT_CONNECTED:
155 case S_INIT_ATS:
156 case S_INIT_BLACKLIST:
157 case S_CONNECT_SENT:
158 case S_CONNECT_RECV_BLACKLIST_INBOUND:
159 case S_CONNECT_RECV_ATS:
160 case S_CONNECT_RECV_BLACKLIST:
161 case S_CONNECT_RECV_ACK:
162 return GNUNET_NO;
163 case S_CONNECTED:
164 case S_RECONNECT_ATS:
165 case S_RECONNECT_BLACKLIST:
166 case S_RECONNECT_SENT:
167 case S_CONNECTED_SWITCHING_BLACKLIST:
168 case S_CONNECTED_SWITCHING_CONNECT_SENT:
169 return GNUNET_YES;
170 case S_DISCONNECT:
171 case S_DISCONNECT_FINISHED:
172 return GNUNET_NO;
173 default:
174 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
175 "Unhandled state `%s' \n",
176 GNUNET_TRANSPORT_p2s (state));
177 GNUNET_break (0);
178 break;
179 }
180 return GNUNET_SYSERR;
181}
182
183/**
184 * Convert state to human-readable string.
185 *
186 * @param state the state value
187 * @return corresponding string
188 */
189const char *
190GNUNET_TRANSPORT_p2s (enum GNUNET_TRANSPORT_PeerState state)
191{
192 switch (state)
193 {
194 case S_NOT_CONNECTED:
195 return "S_NOT_CONNECTED";
196 case S_INIT_ATS:
197 return "S_INIT_ATS";
198 case S_INIT_BLACKLIST:
199 return "S_INIT_BLACKLIST";
200 case S_CONNECT_SENT:
201 return "S_CONNECT_SENT";
202 case S_CONNECT_RECV_BLACKLIST_INBOUND:
203 return "S_CONNECT_RECV_BLACKLIST_INBOUND";
204 case S_CONNECT_RECV_ATS:
205 return "S_CONNECT_RECV_ATS";
206 case S_CONNECT_RECV_BLACKLIST:
207 return "S_CONNECT_RECV_BLACKLIST";
208 case S_CONNECT_RECV_ACK:
209 return "S_CONNECT_RECV_ACK";
210 case S_CONNECTED:
211 return "S_CONNECTED";
212 case S_RECONNECT_ATS:
213 return "S_RECONNECT_ATS";
214 case S_RECONNECT_BLACKLIST:
215 return "S_RECONNECT_BLACKLIST";
216 case S_RECONNECT_SENT:
217 return "S_RECONNECT_SENT";
218 case S_CONNECTED_SWITCHING_BLACKLIST:
219 return "S_CONNECTED_SWITCHING_BLACKLIST";
220 case S_CONNECTED_SWITCHING_CONNECT_SENT:
221 return "S_CONNECTED_SWITCHING_CONNECT_SENT";
222 case S_DISCONNECT:
223 return "S_DISCONNECT";
224 case S_DISCONNECT_FINISHED:
225 return "S_DISCONNECT_FINISHED";
226 default:
227 GNUNET_break (0);
228 return "UNDEFINED";
229 }
230}
143 231
144 232
145/** 233/**
@@ -150,7 +238,7 @@ struct GNUNET_TRANSPORT_ValidationMonitoringContext
150 * message with the human-readable address 238 * message with the human-readable address
151 */ 239 */
152static void 240static void
153peer_address_response_processor (void *cls, 241peer_response_processor (void *cls,
154 const struct GNUNET_MessageHeader *msg); 242 const struct GNUNET_MessageHeader *msg);
155 243
156 244
@@ -162,10 +250,10 @@ peer_address_response_processor (void *cls,
162static void 250static void
163send_request (struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx) 251send_request (struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx)
164{ 252{
165 struct PeerIterateMessage msg; 253 struct PeerMonitorMessage msg;
166 254
167 msg.header.size = htons (sizeof (struct PeerIterateMessage)); 255 msg.header.size = htons (sizeof (struct PeerMonitorMessage));
168 msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE); 256 msg.header.type = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_REQUEST);
169 msg.one_shot = htonl (pal_ctx->one_shot); 257 msg.one_shot = htonl (pal_ctx->one_shot);
170 msg.timeout = GNUNET_TIME_absolute_hton (pal_ctx->timeout); 258 msg.timeout = GNUNET_TIME_absolute_hton (pal_ctx->timeout);
171 msg.peer = pal_ctx->peer; 259 msg.peer = pal_ctx->peer;
@@ -174,7 +262,7 @@ send_request (struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx)
174 &msg.header, 262 &msg.header,
175 GNUNET_TIME_absolute_get_remaining (pal_ctx->timeout), 263 GNUNET_TIME_absolute_get_remaining (pal_ctx->timeout),
176 GNUNET_YES, 264 GNUNET_YES,
177 &peer_address_response_processor, 265 &peer_response_processor,
178 pal_ctx)); 266 pal_ctx));
179} 267}
180 268
@@ -218,16 +306,16 @@ reconnect (struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx)
218/** 306/**
219 * Function called with responses from the service. 307 * Function called with responses from the service.
220 * 308 *
221 * @param cls our 'struct GNUNET_TRANSPORT_PeerAddressLookupContext*' 309 * @param cls our 'struct GNUNET_TRANSPORT_PeerMonitoringContext*'
222 * @param msg NULL on timeout or error, otherwise presumably a 310 * @param msg NULL on timeout or error, otherwise presumably a
223 * message with the human-readable address 311 * message with the human-readable address
224 */ 312 */
225static void 313static void
226peer_address_response_processor (void *cls, 314peer_response_processor (void *cls,
227 const struct GNUNET_MessageHeader *msg) 315 const struct GNUNET_MessageHeader *msg)
228{ 316{
229 struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx = cls; 317 struct GNUNET_TRANSPORT_PeerMonitoringContext *pal_ctx = cls;
230 struct PeerIterateResponseMessage *air_msg; 318 struct PeerIterateResponseMessage *pir_msg;
231 struct GNUNET_HELLO_Address *address; 319 struct GNUNET_HELLO_Address *address;
232 const char *addr; 320 const char *addr;
233 const char *transport_name; 321 const char *transport_name;
@@ -251,7 +339,7 @@ peer_address_response_processor (void *cls,
251 } 339 }
252 size = ntohs (msg->size); 340 size = ntohs (msg->size);
253 GNUNET_break (ntohs (msg->type) == 341 GNUNET_break (ntohs (msg->type) ==
254 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE); 342 GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE);
255 if (size == sizeof (struct GNUNET_MessageHeader)) 343 if (size == sizeof (struct GNUNET_MessageHeader))
256 { 344 {
257 /* done! */ 345 /* done! */
@@ -270,7 +358,7 @@ peer_address_response_processor (void *cls,
270 358
271 if ((size < sizeof (struct PeerIterateResponseMessage)) || 359 if ((size < sizeof (struct PeerIterateResponseMessage)) ||
272 (ntohs (msg->type) != 360 (ntohs (msg->type) !=
273 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_ITERATE_RESPONSE)) 361 GNUNET_MESSAGE_TYPE_TRANSPORT_MONITOR_PEER_RESPONSE))
274 { 362 {
275 GNUNET_break (0); 363 GNUNET_break (0);
276 if (pal_ctx->one_shot) 364 if (pal_ctx->one_shot)
@@ -286,9 +374,9 @@ peer_address_response_processor (void *cls,
286 return; 374 return;
287 } 375 }
288 376
289 air_msg = (struct PeerIterateResponseMessage *) msg; 377 pir_msg = (struct PeerIterateResponseMessage *) msg;
290 tlen = ntohl (air_msg->pluginlen); 378 tlen = ntohl (pir_msg->pluginlen);
291 alen = ntohl (air_msg->addrlen); 379 alen = ntohl (pir_msg->addrlen);
292 380
293 if (size != sizeof (struct PeerIterateResponseMessage) + tlen + alen) 381 if (size != sizeof (struct PeerIterateResponseMessage) + tlen + alen)
294 { 382 {
@@ -308,12 +396,12 @@ peer_address_response_processor (void *cls,
308 396
309 if (alen == 0 && tlen == 0) 397 if (alen == 0 && tlen == 0)
310 { 398 {
311 pal_ctx->cb (pal_ctx->cb_cls, &air_msg->peer, NULL, 399 pal_ctx->cb (pal_ctx->cb_cls, &pir_msg->peer, NULL,
312 S_NOT_CONNECTED, GNUNET_TIME_UNIT_ZERO_ABS); 400 S_NOT_CONNECTED, GNUNET_TIME_UNIT_ZERO_ABS);
313 } 401 }
314 else 402 else
315 { 403 {
316 addr = (const char *) &air_msg[1]; 404 addr = (const char *) &pir_msg[1];
317 transport_name = &addr[alen]; 405 transport_name = &addr[alen];
318 406
319 if (transport_name[tlen - 1] != '\0') 407 if (transport_name[tlen - 1] != '\0')
@@ -333,16 +421,16 @@ peer_address_response_processor (void *cls,
333 } 421 }
334 422
335 /* notify client */ 423 /* notify client */
336 address = GNUNET_HELLO_address_allocate (&air_msg->peer, 424 address = GNUNET_HELLO_address_allocate (&pir_msg->peer,
337 transport_name, addr, alen); 425 transport_name, addr, alen);
338 pal_ctx->cb (pal_ctx->cb_cls, &air_msg->peer, address, 426 pal_ctx->cb (pal_ctx->cb_cls, &pir_msg->peer, address,
339 ntohl(air_msg->state), 427 ntohl(pir_msg->state),
340 GNUNET_TIME_absolute_ntoh (air_msg->state_timeout)); 428 GNUNET_TIME_absolute_ntoh (pir_msg->state_timeout));
341 GNUNET_HELLO_address_free (address); 429 GNUNET_HELLO_address_free (address);
342 } 430 }
343 431
344 /* expect more replies */ 432 /* expect more replies */
345 GNUNET_CLIENT_receive (pal_ctx->client, &peer_address_response_processor, 433 GNUNET_CLIENT_receive (pal_ctx->client, &peer_response_processor,
346 pal_ctx, 434 pal_ctx,
347 GNUNET_TIME_absolute_get_remaining (pal_ctx->timeout)); 435 GNUNET_TIME_absolute_get_remaining (pal_ctx->timeout));
348} 436}