aboutsummaryrefslogtreecommitdiff
path: root/src/core/core_api_iterate_peers.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-22 21:59:27 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-22 21:59:27 +0000
commitf44c0036572d5557d2496748a4190a61e40e61ff (patch)
treebceb908e8542883ed246f96b4c619c0c49a06782 /src/core/core_api_iterate_peers.c
parent9d87d51965287d83ee332b8c50baff95bd62649a (diff)
downloadgnunet-f44c0036572d5557d2496748a4190a61e40e61ff.tar.gz
gnunet-f44c0036572d5557d2496748a4190a61e40e61ff.zip
replacing 0-terminated atsi-array with array+length in core API (and the core-connect IPC)
Diffstat (limited to 'src/core/core_api_iterate_peers.c')
-rw-r--r--src/core/core_api_iterate_peers.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/core/core_api_iterate_peers.c b/src/core/core_api_iterate_peers.c
index ed9ea175e..7bf40a678 100644
--- a/src/core/core_api_iterate_peers.c
+++ b/src/core/core_api_iterate_peers.c
@@ -79,7 +79,7 @@ receive_info (void *cls, const struct GNUNET_MessageHeader *msg)
79 (ntohs (msg->size) == sizeof (struct GNUNET_MessageHeader)))) 79 (ntohs (msg->size) == sizeof (struct GNUNET_MessageHeader))))
80 { 80 {
81 if (request_context->peer_cb != NULL) 81 if (request_context->peer_cb != NULL)
82 request_context->peer_cb (request_context->cb_cls, NULL, NULL); 82 request_context->peer_cb (request_context->cb_cls, NULL, NULL, 0);
83 GNUNET_CLIENT_disconnect (request_context->client, GNUNET_NO); 83 GNUNET_CLIENT_disconnect (request_context->client, GNUNET_NO);
84 GNUNET_free (request_context); 84 GNUNET_free (request_context);
85 return; 85 return;
@@ -92,22 +92,20 @@ receive_info (void *cls, const struct GNUNET_MessageHeader *msg)
92 { 92 {
93 GNUNET_break (0); 93 GNUNET_break (0);
94 if (request_context->peer_cb != NULL) 94 if (request_context->peer_cb != NULL)
95 request_context->peer_cb (request_context->cb_cls, NULL, NULL); 95 request_context->peer_cb (request_context->cb_cls, NULL, NULL, 0);
96 GNUNET_CLIENT_disconnect (request_context->client, GNUNET_NO); 96 GNUNET_CLIENT_disconnect (request_context->client, GNUNET_NO);
97 GNUNET_free (request_context); 97 GNUNET_free (request_context);
98 return; 98 return;
99 } 99 }
100 connect_message = (const struct ConnectNotifyMessage *) msg; 100 connect_message = (const struct ConnectNotifyMessage *) msg;
101 ats_count = ntohl (connect_message->ats_count); 101 ats_count = ntohl (connect_message->ats_count);
102 if ((msize != 102 if (msize !=
103 sizeof (struct ConnectNotifyMessage) + 103 sizeof (struct ConnectNotifyMessage) +
104 ats_count * sizeof (struct GNUNET_ATS_Information)) || 104 ats_count * sizeof (struct GNUNET_ATS_Information))
105 (GNUNET_ATS_ARRAY_TERMINATOR !=
106 ntohl ((&connect_message->ats)[ats_count].type)))
107 { 105 {
108 GNUNET_break (0); 106 GNUNET_break (0);
109 if (request_context->peer_cb != NULL) 107 if (request_context->peer_cb != NULL)
110 request_context->peer_cb (request_context->cb_cls, NULL, NULL); 108 request_context->peer_cb (request_context->cb_cls, NULL, NULL, 0);
111 GNUNET_CLIENT_disconnect (request_context->client, GNUNET_NO); 109 GNUNET_CLIENT_disconnect (request_context->client, GNUNET_NO);
112 GNUNET_free (request_context); 110 GNUNET_free (request_context);
113 return; 111 return;
@@ -115,7 +113,8 @@ receive_info (void *cls, const struct GNUNET_MessageHeader *msg)
115 /* Normal case */ 113 /* Normal case */
116 if (request_context->peer_cb != NULL) 114 if (request_context->peer_cb != NULL)
117 request_context->peer_cb (request_context->cb_cls, &connect_message->peer, 115 request_context->peer_cb (request_context->cb_cls, &connect_message->peer,
118 &connect_message->ats); 116 (const struct GNUNET_ATS_Information *) &connect_message[1],
117 ats_count);
119 GNUNET_CLIENT_receive (request_context->client, &receive_info, 118 GNUNET_CLIENT_receive (request_context->client, &receive_info,
120 request_context, GNUNET_TIME_UNIT_FOREVER_REL); 119 request_context, GNUNET_TIME_UNIT_FOREVER_REL);
121} 120}