diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-10-22 21:59:27 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-10-22 21:59:27 +0000 |
commit | f44c0036572d5557d2496748a4190a61e40e61ff (patch) | |
tree | bceb908e8542883ed246f96b4c619c0c49a06782 /src/hostlist | |
parent | 9d87d51965287d83ee332b8c50baff95bd62649a (diff) | |
download | gnunet-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/hostlist')
-rw-r--r-- | src/hostlist/gnunet-daemon-hostlist.c | 15 | ||||
-rw-r--r-- | src/hostlist/hostlist-client.c | 8 | ||||
-rw-r--r-- | src/hostlist/hostlist-server.c | 4 | ||||
-rw-r--r-- | src/hostlist/test_gnunet_daemon_hostlist_learning.c | 3 |
4 files changed, 21 insertions, 9 deletions
diff --git a/src/hostlist/gnunet-daemon-hostlist.c b/src/hostlist/gnunet-daemon-hostlist.c index fb23d2345..2ef807444 100644 --- a/src/hostlist/gnunet-daemon-hostlist.c +++ b/src/hostlist/gnunet-daemon-hostlist.c | |||
@@ -136,14 +136,17 @@ core_init (void *cls, struct GNUNET_CORE_Handle *server, | |||
136 | 136 | ||
137 | /** | 137 | /** |
138 | * Core handler for p2p hostlist advertisements | 138 | * Core handler for p2p hostlist advertisements |
139 | * | ||
140 | * @param atsi_count number of records in 'atsi' | ||
139 | */ | 141 | */ |
140 | static int | 142 | static int |
141 | advertisement_handler (void *cls, const struct GNUNET_PeerIdentity *peer, | 143 | advertisement_handler (void *cls, const struct GNUNET_PeerIdentity *peer, |
142 | const struct GNUNET_MessageHeader *message, | 144 | const struct GNUNET_MessageHeader *message, |
143 | const struct GNUNET_ATS_Information *atsi) | 145 | const struct GNUNET_ATS_Information *atsi, |
146 | unsigned int atsi_count) | ||
144 | { | 147 | { |
145 | GNUNET_assert (NULL != client_adv_handler); | 148 | GNUNET_assert (NULL != client_adv_handler); |
146 | return (*client_adv_handler) (cls, peer, message, atsi); | 149 | return (*client_adv_handler) (cls, peer, message, atsi, atsi_count); |
147 | } | 150 | } |
148 | 151 | ||
149 | 152 | ||
@@ -153,20 +156,22 @@ advertisement_handler (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
153 | * @param cls closure | 156 | * @param cls closure |
154 | * @param peer peer identity this notification is about | 157 | * @param peer peer identity this notification is about |
155 | * @param atsi performance data | 158 | * @param atsi performance data |
159 | * @param atsi_count number of records in 'atsi' | ||
156 | */ | 160 | */ |
157 | static void | 161 | static void |
158 | connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, | 162 | connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, |
159 | const struct GNUNET_ATS_Information *atsi) | 163 | const struct GNUNET_ATS_Information *atsi, |
164 | unsigned int atsi_count) | ||
160 | { | 165 | { |
161 | if (0 == memcmp (&me, peer, sizeof (struct GNUNET_PeerIdentity))) | 166 | if (0 == memcmp (&me, peer, sizeof (struct GNUNET_PeerIdentity))) |
162 | return; | 167 | return; |
163 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 168 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
164 | "A new peer connected, notifying client and server\n"); | 169 | "A new peer connected, notifying client and server\n"); |
165 | if (NULL != client_ch) | 170 | if (NULL != client_ch) |
166 | (*client_ch) (cls, peer, atsi); | 171 | (*client_ch) (cls, peer, atsi, atsi_count); |
167 | #if HAVE_MHD | 172 | #if HAVE_MHD |
168 | if (NULL != server_ch) | 173 | if (NULL != server_ch) |
169 | (*server_ch) (cls, peer, atsi); | 174 | (*server_ch) (cls, peer, atsi, atsi_count); |
170 | #endif | 175 | #endif |
171 | } | 176 | } |
172 | 177 | ||
diff --git a/src/hostlist/hostlist-client.c b/src/hostlist/hostlist-client.c index 1f3ad2a7c..ba5093779 100644 --- a/src/hostlist/hostlist-client.c +++ b/src/hostlist/hostlist-client.c | |||
@@ -1107,10 +1107,12 @@ task_hostlist_saving (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1107 | * @param cls closure | 1107 | * @param cls closure |
1108 | * @param peer peer identity this notification is about | 1108 | * @param peer peer identity this notification is about |
1109 | * @param atsi performance data | 1109 | * @param atsi performance data |
1110 | * @param atsi_count number of records in 'atsi' | ||
1110 | */ | 1111 | */ |
1111 | static void | 1112 | static void |
1112 | handler_connect (void *cls, const struct GNUNET_PeerIdentity *peer, | 1113 | handler_connect (void *cls, const struct GNUNET_PeerIdentity *peer, |
1113 | const struct GNUNET_ATS_Information *atsi) | 1114 | const struct GNUNET_ATS_Information *atsi, |
1115 | unsigned int atsi_count) | ||
1114 | { | 1116 | { |
1115 | GNUNET_assert (stat_connection_count < UINT_MAX); | 1117 | GNUNET_assert (stat_connection_count < UINT_MAX); |
1116 | stat_connection_count++; | 1118 | stat_connection_count++; |
@@ -1142,13 +1144,15 @@ handler_disconnect (void *cls, const struct GNUNET_PeerIdentity *peer) | |||
1142 | * @param peer the peer sending the message | 1144 | * @param peer the peer sending the message |
1143 | * @param message the actual message | 1145 | * @param message the actual message |
1144 | * @param atsi performance data | 1146 | * @param atsi performance data |
1147 | * @param atsi_count number of records in 'atsi' | ||
1145 | * @return GNUNET_OK to keep the connection open, | 1148 | * @return GNUNET_OK to keep the connection open, |
1146 | * GNUNET_SYSERR to close it (signal serious error) | 1149 | * GNUNET_SYSERR to close it (signal serious error) |
1147 | */ | 1150 | */ |
1148 | static int | 1151 | static int |
1149 | handler_advertisement (void *cls, const struct GNUNET_PeerIdentity *peer, | 1152 | handler_advertisement (void *cls, const struct GNUNET_PeerIdentity *peer, |
1150 | const struct GNUNET_MessageHeader *message, | 1153 | const struct GNUNET_MessageHeader *message, |
1151 | const struct GNUNET_ATS_Information *atsi) | 1154 | const struct GNUNET_ATS_Information *atsi, |
1155 | unsigned int atsi_count) | ||
1152 | { | 1156 | { |
1153 | size_t size; | 1157 | size_t size; |
1154 | size_t uri_size; | 1158 | size_t uri_size; |
diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c index fb4c1b1b9..a6d9c126c 100644 --- a/src/hostlist/hostlist-server.c +++ b/src/hostlist/hostlist-server.c | |||
@@ -362,10 +362,12 @@ adv_transmit_ready (void *cls, size_t size, void *buf) | |||
362 | * @param cls closure | 362 | * @param cls closure |
363 | * @param peer peer identity this notification is about | 363 | * @param peer peer identity this notification is about |
364 | * @param atsi performance data | 364 | * @param atsi performance data |
365 | * @param atsi_count number of records in 'atsi' | ||
365 | */ | 366 | */ |
366 | static void | 367 | static void |
367 | connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, | 368 | connect_handler (void *cls, const struct GNUNET_PeerIdentity *peer, |
368 | const struct GNUNET_ATS_Information *atsi) | 369 | const struct GNUNET_ATS_Information *atsi, |
370 | unsigned int atsi_count) | ||
369 | { | 371 | { |
370 | size_t size; | 372 | size_t size; |
371 | 373 | ||
diff --git a/src/hostlist/test_gnunet_daemon_hostlist_learning.c b/src/hostlist/test_gnunet_daemon_hostlist_learning.c index 9d72433ce..dfeca8d57 100644 --- a/src/hostlist/test_gnunet_daemon_hostlist_learning.c +++ b/src/hostlist/test_gnunet_daemon_hostlist_learning.c | |||
@@ -298,7 +298,8 @@ check_statistics (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
298 | static int | 298 | static int |
299 | ad_arrive_handler (void *cls, const struct GNUNET_PeerIdentity *peer, | 299 | ad_arrive_handler (void *cls, const struct GNUNET_PeerIdentity *peer, |
300 | const struct GNUNET_MessageHeader *message, | 300 | const struct GNUNET_MessageHeader *message, |
301 | const struct GNUNET_ATS_Information *atsi) | 301 | const struct GNUNET_ATS_Information *atsi, |
302 | unsigned int atsi_count) | ||
302 | { | 303 | { |
303 | char *hostname; | 304 | char *hostname; |
304 | char *expected_uri; | 305 | char *expected_uri; |