diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-11-08 23:20:42 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-11-08 23:20:42 +0000 |
commit | a983a0267109b1b6a8e16e476e2f2956a8771b94 (patch) | |
tree | 79bcae73cdb7b87b4f55d4396e79baea76ef53a6 /src/ats/ats_api_performance.c | |
parent | a3f8ef5b89dc44fc3acfb8f081a502f3409e4224 (diff) | |
download | gnunet-a983a0267109b1b6a8e16e476e2f2956a8771b94.tar.gz gnunet-a983a0267109b1b6a8e16e476e2f2956a8771b94.zip |
refactoring how we handle peer addresses in peerinfo/ats/transport/hello subsystems -- use a struct instead of 3--4 arguments
Diffstat (limited to 'src/ats/ats_api_performance.c')
-rw-r--r-- | src/ats/ats_api_performance.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c index ca489e4a6..8ac88ec63 100644 --- a/src/ats/ats_api_performance.c +++ b/src/ats/ats_api_performance.c | |||
@@ -269,9 +269,10 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph, | |||
269 | { | 269 | { |
270 | const struct PeerInformationMessage *pi; | 270 | const struct PeerInformationMessage *pi; |
271 | const struct GNUNET_ATS_Information *atsi; | 271 | const struct GNUNET_ATS_Information *atsi; |
272 | const char *address; | 272 | const char *plugin_address; |
273 | const char *plugin_name; | 273 | const char *plugin_name; |
274 | uint16_t address_length; | 274 | struct GNUNET_HELLO_Address address; |
275 | uint16_t plugin_address_length; | ||
275 | uint16_t plugin_name_length; | 276 | uint16_t plugin_name_length; |
276 | uint32_t ats_count; | 277 | uint32_t ats_count; |
277 | 278 | ||
@@ -287,12 +288,12 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph, | |||
287 | } | 288 | } |
288 | pi = (const struct PeerInformationMessage *) msg; | 289 | pi = (const struct PeerInformationMessage *) msg; |
289 | ats_count = ntohl (pi->ats_count); | 290 | ats_count = ntohl (pi->ats_count); |
290 | address_length = ntohs (pi->address_length); | 291 | plugin_address_length = ntohs (pi->address_length); |
291 | plugin_name_length = ntohs (pi->plugin_name_length); | 292 | plugin_name_length = ntohs (pi->plugin_name_length); |
292 | atsi = (const struct GNUNET_ATS_Information *) &pi[1]; | 293 | atsi = (const struct GNUNET_ATS_Information *) &pi[1]; |
293 | address = (const char *) &atsi[ats_count]; | 294 | plugin_address = (const char *) &atsi[ats_count]; |
294 | plugin_name = &address[address_length]; | 295 | plugin_name = &plugin_address[plugin_address_length]; |
295 | if ((address_length + plugin_name_length + | 296 | if ((plugin_address_length + plugin_name_length + |
296 | ats_count * sizeof (struct GNUNET_ATS_Information) + | 297 | ats_count * sizeof (struct GNUNET_ATS_Information) + |
297 | sizeof (struct PeerInformationMessage) != ntohs (msg->size)) || | 298 | sizeof (struct PeerInformationMessage) != ntohs (msg->size)) || |
298 | (ats_count > | 299 | (ats_count > |
@@ -302,7 +303,11 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph, | |||
302 | GNUNET_break (0); | 303 | GNUNET_break (0); |
303 | return GNUNET_SYSERR; | 304 | return GNUNET_SYSERR; |
304 | } | 305 | } |
305 | ph->infocb (ph->infocb_cls, &pi->peer, plugin_name, address, address_length, | 306 | address.peer = pi->peer; |
307 | address.address = plugin_address; | ||
308 | address.address_length = plugin_address_length; | ||
309 | address.transport_name = plugin_name; | ||
310 | ph->infocb (ph->infocb_cls, &address, | ||
306 | pi->bandwidth_out, pi->bandwidth_in, atsi, ats_count); | 311 | pi->bandwidth_out, pi->bandwidth_in, atsi, ats_count); |
307 | return GNUNET_OK; | 312 | return GNUNET_OK; |
308 | } | 313 | } |