/*
This file is part of GNUnet.
- Copyright (C) 2011 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2011 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
* @file ats/gnunet-service-ats.c
(const struct ClientStartMessage *) message;
enum StartFlag flag;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received `%s' message\n",
- "ATS_START");
flag = ntohl (msg->start_flag);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received ATS_START (%d) message\n",
+ (int) flag);
switch (flag)
{
case START_FLAG_SCHEDULING:
if (GNUNET_OK != GAS_scheduling_add_client (client))
{
- GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
return;
}
break;
case START_FLAG_PERFORMANCE_WITH_PIC:
- GAS_performance_add_client (client, flag);
+ GAS_performance_add_client (client,
+ flag);
break;
case START_FLAG_PERFORMANCE_NO_PIC:
- GAS_performance_add_client (client, flag);
+ GAS_performance_add_client (client,
+ flag);
break;
case START_FLAG_CONNECTION_SUGGESTION:
/* This client won't receive messages from us, no need to 'add' */
break;
default:
GNUNET_break (0);
- GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_SYSERR);
return;
}
- GNUNET_SERVER_receive_done (client, GNUNET_OK);
+ GNUNET_SERVER_receive_done (client,
+ GNUNET_OK);
}
* Task run during shutdown.
*
* @param cls unused
- * @param tc unused
*/
static void
-cleanup_task (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+cleanup_task (void *cls)
{
- GAS_addresses_done ();
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "ATS shutdown initiated\n");
GAS_connectivity_done ();
+ GAS_addresses_done ();
GAS_plugin_done ();
GAS_normalization_stop ();
GAS_scheduling_done ();
GAS_performance_done ();
GAS_preference_done ();
GAS_reservations_done ();
- GNUNET_SERVER_disconnect_notify_cancel (GSA_server,
- &client_disconnect_handler,
- NULL);
if (NULL != GSA_stats)
{
GNUNET_STATISTICS_destroy (GSA_stats, GNUNET_NO);
{&GAS_handle_address_add, NULL,
GNUNET_MESSAGE_TYPE_ATS_ADDRESS_ADD, 0},
{&GAS_handle_address_update, NULL,
- GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE, 0},
+ GNUNET_MESSAGE_TYPE_ATS_ADDRESS_UPDATE,
+ sizeof (struct AddressUpdateMessage) },
{&GAS_handle_address_destroyed, NULL,
GNUNET_MESSAGE_TYPE_ATS_ADDRESS_DESTROYED,
sizeof (struct AddressDestroyedMessage) },
&client_disconnect_handler,
NULL);
GNUNET_SERVER_add_handlers (server, handlers);
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
- &cleanup_task,
- NULL);
+ GNUNET_SCHEDULER_add_shutdown (&cleanup_task,
+ NULL);
}