aboutsummaryrefslogtreecommitdiff
path: root/src/ats
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-11-29 20:47:18 +0000
committerChristian Grothoff <christian@grothoff.org>2011-11-29 20:47:18 +0000
commit71ea5bd2d05058008e604ffd42993be9c7250e04 (patch)
treea5074671ddfaa9d1621a4182fc95a91a98b3d536 /src/ats
parentb335777fd435142c16eb05e86c8a64a4b1a45447 (diff)
downloadgnunet-71ea5bd2d05058008e604ffd42993be9c7250e04.tar.gz
gnunet-71ea5bd2d05058008e604ffd42993be9c7250e04.zip
-fixing indentation
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/ats_api.c4
-rw-r--r--src/ats/ats_api_performance.c4
-rw-r--r--src/ats/ats_api_scheduling.c81
-rw-r--r--src/ats/gnunet-service-ats_addresses.c43
-rw-r--r--src/ats/gnunet-service-ats_addresses.h3
-rw-r--r--src/ats/gnunet-service-ats_scheduling.c23
-rw-r--r--src/ats/gnunet-service-ats_scheduling.h5
-rw-r--r--src/ats/test_ats_api_scheduling.c12
8 files changed, 83 insertions, 92 deletions
diff --git a/src/ats/ats_api.c b/src/ats/ats_api.c
index 47daad6cf..7c0fb2d32 100644
--- a/src/ats/ats_api.c
+++ b/src/ats/ats_api.c
@@ -342,9 +342,9 @@ GNUNET_ATS_init (const struct GNUNET_CONFIGURATION_Handle *cfg,
342 atc->peers = GNUNET_CONTAINER_multihashmap_create (256); 342 atc->peers = GNUNET_CONTAINER_multihashmap_create (256);
343 atc->notify_map = GNUNET_CONTAINER_multihashmap_create (256); 343 atc->notify_map = GNUNET_CONTAINER_multihashmap_create (256);
344 GNUNET_CONFIGURATION_get_value_size (cfg, "ats", "WAN_QUOTA_OUT", 344 GNUNET_CONFIGURATION_get_value_size (cfg, "ats", "WAN_QUOTA_OUT",
345 &atc->total_bps_out); 345 &atc->total_bps_out);
346 GNUNET_CONFIGURATION_get_value_size (cfg, "ats", "WAN_QUOTA_IN", 346 GNUNET_CONFIGURATION_get_value_size (cfg, "ats", "WAN_QUOTA_IN",
347 &atc->total_bps_in); 347 &atc->total_bps_in);
348 return atc; 348 return atc;
349} 349}
350 350
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c
index 9739ac1e5..c9f9a0b38 100644
--- a/src/ats/ats_api_performance.c
+++ b/src/ats/ats_api_performance.c
@@ -307,8 +307,8 @@ process_pi_message (struct GNUNET_ATS_PerformanceHandle *ph,
307 address.address = plugin_address; 307 address.address = plugin_address;
308 address.address_length = plugin_address_length; 308 address.address_length = plugin_address_length;
309 address.transport_name = plugin_name; 309 address.transport_name = plugin_name;
310 ph->infocb (ph->infocb_cls, &address, 310 ph->infocb (ph->infocb_cls, &address, pi->bandwidth_out, pi->bandwidth_in,
311 pi->bandwidth_out, pi->bandwidth_in, atsi, ats_count); 311 atsi, ats_count);
312 return GNUNET_OK; 312 return GNUNET_OK;
313} 313}
314 314
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c
index 89a3bb472..0658e362c 100644
--- a/src/ats/ats_api_scheduling.c
+++ b/src/ats/ats_api_scheduling.c
@@ -287,11 +287,8 @@ find_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
287 const struct GNUNET_PeerIdentity *peer) 287 const struct GNUNET_PeerIdentity *peer)
288{ 288{
289#if DEBUG_ATS 289#if DEBUG_ATS
290 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 290 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Find session %u from peer %s in %p\n",
291 "Find session %u from peer %s in %p\n", 291 (unsigned int) session_id, GNUNET_i2s (peer), sh);
292 (unsigned int) session_id,
293 GNUNET_i2s (peer),
294 sh);
295#endif 292#endif
296 if (session_id >= sh->session_array_size) 293 if (session_id >= sh->session_array_size)
297 { 294 {
@@ -303,14 +300,14 @@ find_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
303 if (sh->session_array[session_id].session == NULL) 300 if (sh->session_array[session_id].session == NULL)
304 { 301 {
305 GNUNET_break (0 == 302 GNUNET_break (0 ==
306 memcmp (peer, &sh->session_array[session_id].peer, 303 memcmp (peer, &sh->session_array[session_id].peer,
307 sizeof (struct GNUNET_PeerIdentity))); 304 sizeof (struct GNUNET_PeerIdentity)));
308 return NULL; 305 return NULL;
309 } 306 }
310 307
311 if (0 != 308 if (0 !=
312 memcmp (peer, &sh->session_array[session_id].peer, 309 memcmp (peer, &sh->session_array[session_id].peer,
313 sizeof (struct GNUNET_PeerIdentity))) 310 sizeof (struct GNUNET_PeerIdentity)))
314 { 311 {
315 GNUNET_break (0); 312 GNUNET_break (0);
316 sh->reconnect = GNUNET_YES; 313 sh->reconnect = GNUNET_YES;
@@ -338,10 +335,8 @@ get_session_id (struct GNUNET_ATS_SchedulingHandle *sh, struct Session *session,
338 335
339#if DEBUG_ATS 336#if DEBUG_ATS
340 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 337 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
341 "Get session ID for session %p from peer %s in %p\n", 338 "Get session ID for session %p from peer %s in %p\n", session,
342 session, 339 GNUNET_i2s (peer), sh);
343 GNUNET_i2s (peer),
344 sh);
345#endif 340#endif
346 if (NULL == session) 341 if (NULL == session)
347 return 0; 342 return 0;
@@ -350,8 +345,9 @@ get_session_id (struct GNUNET_ATS_SchedulingHandle *sh, struct Session *session,
350 { 345 {
351 if (session == sh->session_array[i].session) 346 if (session == sh->session_array[i].session)
352 { 347 {
353 GNUNET_assert (0 == memcmp (peer, &sh->session_array[i].peer, 348 GNUNET_assert (0 ==
354 sizeof (struct GNUNET_PeerIdentity))); 349 memcmp (peer, &sh->session_array[i].peer,
350 sizeof (struct GNUNET_PeerIdentity)));
355 return i; 351 return i;
356 } 352 }
357 if ((f == 0) && (sh->session_array[i].slot_used == GNUNET_NO)) 353 if ((f == 0) && (sh->session_array[i].slot_used == GNUNET_NO))
@@ -369,11 +365,8 @@ get_session_id (struct GNUNET_ATS_SchedulingHandle *sh, struct Session *session,
369 sh->session_array[f].slot_used = GNUNET_YES; 365 sh->session_array[f].slot_used = GNUNET_YES;
370#if DEBUG_ATS 366#if DEBUG_ATS
371 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 367 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
372 "Assigning session ID %u for session %p of peer %s in %p\n", 368 "Assigning session ID %u for session %p of peer %s in %p\n", f,
373 f, 369 session, GNUNET_i2s (peer), sh);
374 session,
375 GNUNET_i2s (peer),
376 sh);
377#endif 370#endif
378 return f; 371 return f;
379} 372}
@@ -393,16 +386,15 @@ remove_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
393{ 386{
394#if DEBUG_ATS 387#if DEBUG_ATS
395 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 388 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
396 "Remove sessionID %u from peer %s in %p\n", 389 "Remove sessionID %u from peer %s in %p\n",
397 (unsigned int) session_id, 390 (unsigned int) session_id, GNUNET_i2s (peer), sh);
398 GNUNET_i2s (peer),
399 sh);
400#endif 391#endif
401 if (0 == session_id) 392 if (0 == session_id)
402 return; 393 return;
403 GNUNET_assert (session_id < sh->session_array_size); 394 GNUNET_assert (session_id < sh->session_array_size);
404 GNUNET_assert (GNUNET_YES == sh->session_array[session_id].slot_used); 395 GNUNET_assert (GNUNET_YES == sh->session_array[session_id].slot_used);
405 GNUNET_assert (0 == memcmp (peer, &sh->session_array[session_id].peer, 396 GNUNET_assert (0 ==
397 memcmp (peer, &sh->session_array[session_id].peer,
406 sizeof (struct GNUNET_PeerIdentity))); 398 sizeof (struct GNUNET_PeerIdentity)));
407 sh->session_array[session_id].session = NULL; 399 sh->session_array[session_id].session = NULL;
408} 400}
@@ -422,10 +414,8 @@ release_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
422{ 414{
423#if DEBUG_ATS 415#if DEBUG_ATS
424 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 416 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
425 "Release sessionID %u from peer %s in %p\n", 417 "Release sessionID %u from peer %s in %p\n",
426 (unsigned int) session_id, 418 (unsigned int) session_id, GNUNET_i2s (peer), sh);
427 GNUNET_i2s (peer),
428 sh);
429#endif 419#endif
430 if (session_id >= sh->session_array_size) 420 if (session_id >= sh->session_array_size)
431 { 421 {
@@ -437,7 +427,8 @@ release_session (struct GNUNET_ATS_SchedulingHandle *sh, uint32_t session_id,
437 /* this slot should have been removed from remove_session before */ 427 /* this slot should have been removed from remove_session before */
438 GNUNET_assert (sh->session_array[session_id].session == NULL); 428 GNUNET_assert (sh->session_array[session_id].session == NULL);
439 429
440 if (0 != memcmp (peer, &sh->session_array[session_id].peer, 430 if (0 !=
431 memcmp (peer, &sh->session_array[session_id].peer,
441 sizeof (struct GNUNET_PeerIdentity))) 432 sizeof (struct GNUNET_PeerIdentity)))
442 { 433 {
443 GNUNET_break (0); 434 GNUNET_break (0);
@@ -477,7 +468,7 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
477 uint16_t plugin_name_length; 468 uint16_t plugin_name_length;
478 uint32_t ats_count; 469 uint32_t ats_count;
479 struct GNUNET_HELLO_Address address; 470 struct GNUNET_HELLO_Address address;
480 struct Session * s; 471 struct Session *s;
481 472
482 if (NULL == msg) 473 if (NULL == msg)
483 { 474 {
@@ -519,7 +510,7 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
519 force_reconnect (sh); 510 force_reconnect (sh);
520 return; 511 return;
521 } 512 }
522 uint32_t session_id = ntohl (m->session_id); 513 uint32_t session_id = ntohl (m->session_id);
523 514
524 if (session_id == 0) 515 if (session_id == 0)
525 s = NULL; 516 s = NULL;
@@ -529,9 +520,9 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
529 if (s == NULL) 520 if (s == NULL)
530 { 521 {
531#if DEBUG_ATS 522#if DEBUG_ATS
532 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 523 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
533 "ATS tries to use outdated session `%s'\n", 524 "ATS tries to use outdated session `%s'\n",
534 GNUNET_i2s(&m->peer)); 525 GNUNET_i2s (&m->peer));
535#endif 526#endif
536 GNUNET_CLIENT_receive (sh->client, &process_ats_message, sh, 527 GNUNET_CLIENT_receive (sh->client, &process_ats_message, sh,
537 GNUNET_TIME_UNIT_FOREVER_REL); 528 GNUNET_TIME_UNIT_FOREVER_REL);
@@ -545,9 +536,10 @@ process_ats_message (void *cls, const struct GNUNET_MessageHeader *msg)
545 536
546 if ((s == NULL) && (0 == address.address_length)) 537 if ((s == NULL) && (0 == address.address_length))
547 { 538 {
548 GNUNET_log(GNUNET_ERROR_TYPE_ERROR, 539 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
549 "ATS returned invalid address for peer `%s' transport `%s' address length %i, session_id %i\n", 540 "ATS returned invalid address for peer `%s' transport `%s' address length %i, session_id %i\n",
550 GNUNET_i2s(&address.peer) , address.transport_name, plugin_address_length, session_id); 541 GNUNET_i2s (&address.peer), address.transport_name,
542 plugin_address_length, session_id);
551 GNUNET_break_op (0); 543 GNUNET_break_op (0);
552 GNUNET_CLIENT_receive (sh->client, &process_ats_message, sh, 544 GNUNET_CLIENT_receive (sh->client, &process_ats_message, sh,
553 GNUNET_TIME_UNIT_FOREVER_REL); 545 GNUNET_TIME_UNIT_FOREVER_REL);
@@ -731,7 +723,9 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
731 size_t namelen; 723 size_t namelen;
732 size_t msize; 724 size_t msize;
733 725
734 namelen = (address->transport_name == NULL) ? 0 : strlen (address->transport_name) + 1; 726 namelen =
727 (address->transport_name ==
728 NULL) ? 0 : strlen (address->transport_name) + 1;
735 msize = 729 msize =
736 sizeof (struct AddressUpdateMessage) + address->address_length + 730 sizeof (struct AddressUpdateMessage) + address->address_length +
737 ats_count * sizeof (struct GNUNET_ATS_Information) + namelen; 731 ats_count * sizeof (struct GNUNET_ATS_Information) + namelen;
@@ -778,8 +772,7 @@ GNUNET_ATS_address_update (struct GNUNET_ATS_SchedulingHandle *sh,
778void 772void
779GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh, 773GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh,
780 const struct GNUNET_HELLO_Address *address, 774 const struct GNUNET_HELLO_Address *address,
781 struct Session *session, 775 struct Session *session, int in_use)
782 int in_use)
783{ 776{
784 struct PendingMessage *p; 777 struct PendingMessage *p;
785 struct AddressUseMessage *m; 778 struct AddressUseMessage *m;
@@ -788,7 +781,9 @@ GNUNET_ATS_address_in_use (struct GNUNET_ATS_SchedulingHandle *sh,
788 size_t msize; 781 size_t msize;
789 782
790 GNUNET_assert (NULL != address); 783 GNUNET_assert (NULL != address);
791 namelen = (address->transport_name == NULL) ? 0 : strlen (address->transport_name) + 1; 784 namelen =
785 (address->transport_name ==
786 NULL) ? 0 : strlen (address->transport_name) + 1;
792 msize = sizeof (struct AddressUseMessage) + address->address_length + namelen; 787 msize = sizeof (struct AddressUseMessage) + address->address_length + namelen;
793 if ((msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || 788 if ((msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
794 (address->address_length >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || 789 (address->address_length >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
@@ -839,7 +834,9 @@ GNUNET_ATS_address_destroyed (struct GNUNET_ATS_SchedulingHandle *sh,
839 GNUNET_assert (address->transport_name != NULL); 834 GNUNET_assert (address->transport_name != NULL);
840 namelen = strlen (address->transport_name) + 1; 835 namelen = strlen (address->transport_name) + 1;
841 GNUNET_assert (namelen > 1); 836 GNUNET_assert (namelen > 1);
842 msize = sizeof (struct AddressDestroyedMessage) + address->address_length + namelen; 837 msize =
838 sizeof (struct AddressDestroyedMessage) + address->address_length +
839 namelen;
843 if ((msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || 840 if ((msize >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
844 (address->address_length >= GNUNET_SERVER_MAX_MESSAGE_SIZE) || 841 (address->address_length >= GNUNET_SERVER_MAX_MESSAGE_SIZE) ||
845 (namelen >= GNUNET_SERVER_MAX_MESSAGE_SIZE)) 842 (namelen >= GNUNET_SERVER_MAX_MESSAGE_SIZE))
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index 04eacbbb1..e9f7539be 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -305,26 +305,22 @@ destroy_by_session_id (void *cls, const GNUNET_HashCode * key, void *value)
305 const struct ATS_Address *info = cls; 305 const struct ATS_Address *info = cls;
306 struct ATS_Address *aa = value; 306 struct ATS_Address *aa = value;
307 307
308 GNUNET_assert (0 == memcmp (&aa->peer, 308 GNUNET_assert (0 ==
309 &info->peer, 309 memcmp (&aa->peer, &info->peer,
310 sizeof (struct GNUNET_PeerIdentity))); 310 sizeof (struct GNUNET_PeerIdentity)));
311 if ( (info->session_id == 0) && 311 if ((info->session_id == 0) && (0 == strcmp (info->plugin, aa->plugin)) &&
312 (0 == strcmp (info->plugin, 312 (aa->addr_len == info->addr_len) &&
313 aa->plugin)) && 313 (0 == memcmp (info->addr, aa->addr, aa->addr_len)))
314 (aa->addr_len == info->addr_len) &&
315 (0 == memcmp (info->addr,
316 aa->addr,
317 aa->addr_len)) )
318 { 314 {
319 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 315 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
320 "Deleting address for peer `%s': `%s'\n", 316 "Deleting address for peer `%s': `%s'\n",
321 GNUNET_i2s (&aa->peer), aa->plugin); 317 GNUNET_i2s (&aa->peer), aa->plugin);
322 if (GNUNET_YES == destroy_address (aa)) 318 if (GNUNET_YES == destroy_address (aa))
323 recalculate_assigned_bw (); 319 recalculate_assigned_bw ();
324 return GNUNET_OK; 320 return GNUNET_OK;
325 } 321 }
326 if (aa->session_id != info->session_id) 322 if (aa->session_id != info->session_id)
327 return GNUNET_OK; /* irrelevant */ 323 return GNUNET_OK; /* irrelevant */
328 if (aa->session_id != 0) 324 if (aa->session_id != 0)
329 GNUNET_break (0 == strcmp (info->plugin, aa->plugin)); 325 GNUNET_break (0 == strcmp (info->plugin, aa->plugin));
330 /* session died */ 326 /* session died */
@@ -358,10 +354,8 @@ GAS_addresses_destroy (const struct GNUNET_PeerIdentity *peer,
358 aa.addr = plugin_addr; 354 aa.addr = plugin_addr;
359 aa.plugin = (char *) plugin_name; 355 aa.plugin = (char *) plugin_name;
360 aa.session_id = session_id; 356 aa.session_id = session_id;
361 GNUNET_CONTAINER_multihashmap_get_multiple (addresses, 357 GNUNET_CONTAINER_multihashmap_get_multiple (addresses, &peer->hashPubKey,
362 &peer->hashPubKey, 358 &destroy_by_session_id, &aa);
363 &destroy_by_session_id,
364 &aa);
365} 359}
366 360
367 361
@@ -414,12 +408,11 @@ find_address_it (void *cls, const GNUNET_HashCode * key, void *value)
414void 408void
415GAS_addresses_in_use (const struct GNUNET_PeerIdentity *peer, 409GAS_addresses_in_use (const struct GNUNET_PeerIdentity *peer,
416 const char *plugin_name, const void *plugin_addr, 410 const char *plugin_name, const void *plugin_addr,
417 size_t plugin_addr_len, uint32_t session_id, 411 size_t plugin_addr_len, uint32_t session_id, int in_use)
418 int in_use)
419{ 412{
420 413
421 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message for peer `%s': %i\n", 414 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
422 "ADDRESS_IN_USE", 415 "Received `%s' message for peer `%s': %i\n", "ADDRESS_IN_USE",
423 GNUNET_i2s (peer), in_use); 416 GNUNET_i2s (peer), in_use);
424} 417}
425 418
@@ -476,12 +469,12 @@ GAS_addresses_init (const struct GNUNET_CONFIGURATION_Handle *cfg)
476{ 469{
477 GNUNET_assert (GNUNET_OK == 470 GNUNET_assert (GNUNET_OK ==
478 GNUNET_CONFIGURATION_get_value_size (cfg, "ats", 471 GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
479 "WAN_QUOTA_IN", 472 "WAN_QUOTA_IN",
480 &wan_quota_in)); 473 &wan_quota_in));
481 GNUNET_assert (GNUNET_OK == 474 GNUNET_assert (GNUNET_OK ==
482 GNUNET_CONFIGURATION_get_value_size (cfg, "ats", 475 GNUNET_CONFIGURATION_get_value_size (cfg, "ats",
483 "WAN_QUOTA_OUT", 476 "WAN_QUOTA_OUT",
484 &wan_quota_out)); 477 &wan_quota_out));
485 addresses = GNUNET_CONTAINER_multihashmap_create (128); 478 addresses = GNUNET_CONTAINER_multihashmap_create (128);
486} 479}
487 480
diff --git a/src/ats/gnunet-service-ats_addresses.h b/src/ats/gnunet-service-ats_addresses.h
index 95f267bf9..75c220017 100644
--- a/src/ats/gnunet-service-ats_addresses.h
+++ b/src/ats/gnunet-service-ats_addresses.h
@@ -52,8 +52,7 @@ GAS_addresses_done (void);
52void 52void
53GAS_addresses_in_use (const struct GNUNET_PeerIdentity *peer, 53GAS_addresses_in_use (const struct GNUNET_PeerIdentity *peer,
54 const char *plugin_name, const void *plugin_addr, 54 const char *plugin_name, const void *plugin_addr,
55 size_t plugin_addr_len, uint32_t session_id, 55 size_t plugin_addr_len, uint32_t session_id, int in_use);
56 int in_use);
57 56
58void 57void
59GAS_addresses_update (const struct GNUNET_PeerIdentity *peer, 58GAS_addresses_update (const struct GNUNET_PeerIdentity *peer,
diff --git a/src/ats/gnunet-service-ats_scheduling.c b/src/ats/gnunet-service-ats_scheduling.c
index 4659a2363..f5e286a64 100644
--- a/src/ats/gnunet-service-ats_scheduling.c
+++ b/src/ats/gnunet-service-ats_scheduling.c
@@ -142,8 +142,10 @@ GAS_scheduling_transmit_address_suggestion (const struct GNUNET_PeerIdentity
142 memcpy (addrp, plugin_addr, plugin_addr_len); 142 memcpy (addrp, plugin_addr, plugin_addr_len);
143 strcpy (&addrp[plugin_addr_len], plugin_name); 143 strcpy (&addrp[plugin_addr_len], plugin_name);
144 144
145 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ATS sends quota for peer `%s': (in/out) %u/%u\n", 145 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
146 GNUNET_i2s (peer), ntohl (bandwidth_in.value__), ntohl(bandwidth_out.value__)); 146 "ATS sends quota for peer `%s': (in/out) %u/%u\n",
147 GNUNET_i2s (peer), ntohl (bandwidth_in.value__),
148 ntohl (bandwidth_out.value__));
147 149
148 GNUNET_SERVER_notification_context_unicast (nc, my_client, &msg->header, 150 GNUNET_SERVER_notification_context_unicast (nc, my_client, &msg->header,
149 GNUNET_YES); 151 GNUNET_YES);
@@ -182,8 +184,9 @@ GAS_handle_request_address (void *cls, struct GNUNET_SERVER_Client *client,
182 * @param message the request message 184 * @param message the request message
183 */ 185 */
184void 186void
185GAS_handle_request_address_cancel (void *cls, struct GNUNET_SERVER_Client *client, 187GAS_handle_request_address_cancel (void *cls,
186 const struct GNUNET_MessageHeader *message) 188 struct GNUNET_SERVER_Client *client,
189 const struct GNUNET_MessageHeader *message)
187{ 190{
188 const struct RequestAddressMessage *msg = 191 const struct RequestAddressMessage *msg =
189 (const struct RequestAddressMessage *) message; 192 (const struct RequestAddressMessage *) message;
@@ -304,12 +307,8 @@ GAS_handle_address_in_use (void *cls, struct GNUNET_SERVER_Client *client,
304 } 307 }
305 308
306 in_use = ntohs (m->in_use); 309 in_use = ntohs (m->in_use);
307 GAS_addresses_in_use (&m->peer, 310 GAS_addresses_in_use (&m->peer, plugin_name, address, address_length,
308 plugin_name, 311 ntohl (m->session_id), in_use);
309 address,
310 address_length,
311 ntohl (m->session_id),
312 in_use);
313 312
314 GNUNET_SERVER_receive_done (client, GNUNET_OK); 313 GNUNET_SERVER_receive_done (client, GNUNET_OK);
315} 314}
@@ -359,8 +358,8 @@ GAS_handle_address_destroyed (void *cls, struct GNUNET_SERVER_Client *client,
359 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 358 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
360 return; 359 return;
361 } 360 }
362 if ( (plugin_name_length == 0) || 361 if ((plugin_name_length == 0) ||
363 (plugin_name[plugin_name_length - 1] != '\0')) 362 (plugin_name[plugin_name_length - 1] != '\0'))
364 { 363 {
365 GNUNET_break (0); 364 GNUNET_break (0);
366 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 365 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
diff --git a/src/ats/gnunet-service-ats_scheduling.h b/src/ats/gnunet-service-ats_scheduling.h
index cb4e5e08e..45fca2f3d 100644
--- a/src/ats/gnunet-service-ats_scheduling.h
+++ b/src/ats/gnunet-service-ats_scheduling.h
@@ -98,8 +98,9 @@ GAS_handle_request_address (void *cls, struct GNUNET_SERVER_Client *client,
98 * @param message the request message 98 * @param message the request message
99 */ 99 */
100void 100void
101GAS_handle_request_address_cancel (void *cls, struct GNUNET_SERVER_Client *client, 101GAS_handle_request_address_cancel (void *cls,
102 const struct GNUNET_MessageHeader *message); 102 struct GNUNET_SERVER_Client *client,
103 const struct GNUNET_MessageHeader *message);
103 104
104/** 105/**
105 * Handle 'address update' messages from clients. 106 * Handle 'address update' messages from clients.
diff --git a/src/ats/test_ats_api_scheduling.c b/src/ats/test_ats_api_scheduling.c
index bf11aef8d..fdff3e36d 100644
--- a/src/ats/test_ats_api_scheduling.c
+++ b/src/ats/test_ats_api_scheduling.c
@@ -118,8 +118,7 @@ end ()
118 118
119 119
120static void 120static void
121address_suggest_cb (void *cls, 121address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address,
122 const struct GNUNET_HELLO_Address *address,
123 struct Session *session, 122 struct Session *session,
124 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, 123 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
125 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, 124 struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
@@ -130,10 +129,13 @@ address_suggest_cb (void *cls,
130 GNUNET_i2s (&address->peer)); 129 GNUNET_i2s (&address->peer));
131 130
132 GNUNET_assert (0 == 131 GNUNET_assert (0 ==
133 memcmp (&address->peer, &p[0].id, sizeof (struct GNUNET_PeerIdentity))); 132 memcmp (&address->peer, &p[0].id,
133 sizeof (struct GNUNET_PeerIdentity)));
134 GNUNET_assert (0 == strcmp (address->transport_name, addr[0].plugin)); 134 GNUNET_assert (0 == strcmp (address->transport_name, addr[0].plugin));
135 GNUNET_assert (address->address_length == addr[0].addr_len); 135 GNUNET_assert (address->address_length == addr[0].addr_len);
136 GNUNET_assert (0 == memcmp (address->address, addr[0].plugin, address->address_length)); 136 GNUNET_assert (0 ==
137 memcmp (address->address, addr[0].plugin,
138 address->address_length));
137 GNUNET_assert (addr[0].session == session); 139 GNUNET_assert (addr[0].session == session);
138 140
139 141
@@ -224,7 +226,7 @@ check (void *cls, char *const *args, const char *cfgfile,
224 GNUNET_ATS_address_update (ats, &address0, addr[0].session, atsi, 2); 226 GNUNET_ATS_address_update (ats, &address0, addr[0].session, atsi, 2);
225 227
226 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing manual address deletion \n"); 228 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing manual address deletion \n");
227 address0.peer = p[1].id; // FIXME: why? typo in old code? 229 address0.peer = p[1].id; // FIXME: why? typo in old code?
228 GNUNET_ATS_address_update (ats, &address0, addr[0].session, NULL, 0); 230 GNUNET_ATS_address_update (ats, &address0, addr[0].session, NULL, 0);
229 GNUNET_ATS_address_destroyed (ats, &address0, addr[0].session); 231 GNUNET_ATS_address_destroyed (ats, &address0, addr[0].session);
230 232