aboutsummaryrefslogtreecommitdiff
path: root/src/ats/gnunet-service-ats_scheduling.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-22 21:32:12 +0000
committerChristian Grothoff <christian@grothoff.org>2015-01-22 21:32:12 +0000
commit2a51624aec1b1a5bc464853c5446f628fa3b99f0 (patch)
treec14871c53cd71245fa473b729aa9fec0d66fd788 /src/ats/gnunet-service-ats_scheduling.c
parent750da2796162b92c533f9666104c47407ed09e46 (diff)
downloadgnunet-2a51624aec1b1a5bc464853c5446f628fa3b99f0.tar.gz
gnunet-2a51624aec1b1a5bc464853c5446f628fa3b99f0.zip
simplifying IPC for address destruction
Diffstat (limited to 'src/ats/gnunet-service-ats_scheduling.c')
-rw-r--r--src/ats/gnunet-service-ats_scheduling.c45
1 files changed, 3 insertions, 42 deletions
diff --git a/src/ats/gnunet-service-ats_scheduling.c b/src/ats/gnunet-service-ats_scheduling.c
index 685c6535d..d89b274a4 100644
--- a/src/ats/gnunet-service-ats_scheduling.c
+++ b/src/ats/gnunet-service-ats_scheduling.c
@@ -393,56 +393,17 @@ GAS_handle_address_destroyed (void *cls,
393{ 393{
394 const struct AddressDestroyedMessage *m; 394 const struct AddressDestroyedMessage *m;
395 struct SessionReleaseMessage srm; 395 struct SessionReleaseMessage srm;
396 const char *address;
397 const char *plugin_name;
398 uint16_t address_length;
399 uint16_t plugin_name_length;
400 uint16_t size;
401 396
402 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
403 "Received `%s' message of size %u %u\n",
404 "ADDRESS_DESTROYED",
405 ntohs (message->size),
406 sizeof (struct AddressDestroyedMessage));
407 size = ntohs (message->size);
408 if ((size < sizeof (struct AddressDestroyedMessage)) || (client != my_client))
409 {
410 GNUNET_break (0);
411 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
412 return;
413 }
414 m = (const struct AddressDestroyedMessage *) message; 397 m = (const struct AddressDestroyedMessage *) message;
415 GNUNET_break (0 == ntohl (m->reserved)); 398 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
416 address_length = ntohs (m->address_length); 399 "Received `%s' message\n",
417 plugin_name_length = ntohs (m->plugin_name_length); 400 "ADDRESS_DESTROYED");
418 address = (const char *) &m[1];
419 if (plugin_name_length != 0)
420 plugin_name = &address[address_length];
421 else
422 plugin_name = "";
423 if ((address_length + plugin_name_length +
424 sizeof (struct AddressDestroyedMessage) != ntohs (message->size)))
425 {
426 GNUNET_break (0);
427 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
428 return;
429 }
430 if ((0 == plugin_name_length) ||
431 (plugin_name[plugin_name_length - 1] != '\0'))
432 {
433 GNUNET_break (0);
434 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
435 return;
436 }
437 GNUNET_STATISTICS_update (GSA_stats, 401 GNUNET_STATISTICS_update (GSA_stats,
438 "# addresses destroyed", 402 "# addresses destroyed",
439 1, 403 1,
440 GNUNET_NO); 404 GNUNET_NO);
441 GAS_addresses_destroy (address_handle, 405 GAS_addresses_destroy (address_handle,
442 &m->peer, 406 &m->peer,
443 plugin_name,
444 address, address_length,
445 ntohl (m->address_local_info),
446 ntohl (m->session_id)); 407 ntohl (m->session_id));
447 srm.header.type = ntohs (GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE); 408 srm.header.type = ntohs (GNUNET_MESSAGE_TYPE_ATS_SESSION_RELEASE);
448 srm.header.size = ntohs (sizeof (struct SessionReleaseMessage)); 409 srm.header.size = ntohs (sizeof (struct SessionReleaseMessage));