This file is part of GNUnet.
Copyright (C) 2009, 2010, 2011, 2016 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
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- 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., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ Affero General Public License for more details.
*/
/**
if (current_heap_size > h->peak_heap_size)
{
h->peak_heap_size = current_heap_size;
- GNUNET_STATISTICS_set (h, "# peak heap size", current_heap_size, GNUNET_NO);
+ GNUNET_STATISTICS_set (h,
+ "# peak heap size",
+ current_heap_size,
+ GNUNET_NO);
}
if (current_rss > h->peak_rss)
{
h->peak_rss = current_rss;
- GNUNET_STATISTICS_set (h, "# peak resident set size", current_rss, GNUNET_NO);
+ GNUNET_STATISTICS_set (h,
+ "# peak resident set size",
+ current_rss,
+ GNUNET_NO);
}
#endif
}
slen = strlen (watch->subsystem) + 1;
nlen = strlen (watch->name) + 1;
nsize = sizeof (struct GNUNET_MessageHeader) + slen + nlen;
- if (nsize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ if (nsize >= GNUNET_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
return;
/**
- * Handle a #GNUNET_MESSAGE_TYPE_TEST (sic) message. We receive this
- * message at the end of the shutdown when the service confirms that
- * all data has been written to disk.
+ * Handle a #GNUNET_MESSAGE_TYPE_STATISTICS_DISCONNECT_CONFIRM
+ * message. We receive this message at the end of the shutdown when
+ * the service confirms that all data has been written to disk.
*
* @param cls our `struct GNUNET_STATISTICS_Handle *`
* @param msg the message
*/
static void
-handle_test (void *cls,
- const struct GNUNET_MessageHeader *msg)
+handle_disconnect_confirm (void *cls,
+ const struct GNUNET_MessageHeader *msg)
{
struct GNUNET_STATISTICS_Handle *h = cls;
return;
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Received TEST message from statistics, can complete disconnect\n");
+ "Received DISCONNNECT_CONFIRM message from statistics, can complete disconnect\n");
if (NULL != h->destroy_task)
GNUNET_SCHEDULER_cancel (h->destroy_task);
h->destroy_task = GNUNET_SCHEDULER_add_now (&do_destroy,
try_connect (struct GNUNET_STATISTICS_Handle *h)
{
struct GNUNET_MQ_MessageHandler handlers[] = {
- GNUNET_MQ_hd_fixed_size (test,
- GNUNET_MESSAGE_TYPE_TEST,
+ GNUNET_MQ_hd_fixed_size (disconnect_confirm,
+ GNUNET_MESSAGE_TYPE_STATISTICS_DISCONNECT_CONFIRM,
struct GNUNET_MessageHeader,
h),
GNUNET_MQ_hd_fixed_size (statistics_end,
return GNUNET_NO;
if (NULL != h->mq)
return GNUNET_YES;
- h->mq = GNUNET_CLIENT_connecT (h->cfg,
+ h->mq = GNUNET_CLIENT_connect (h->cfg,
"statistics",
handlers,
&mq_error_handler,
*/
loss = GNUNET_NO;
for (gh = h->action_head; NULL != gh; gh = gh->next)
- if ( (gh->make_persistent) && (ACTION_SET == gh->type) )
+ if ( (gh->make_persistent) &&
+ (ACTION_SET == gh->type) )
loss = GNUNET_YES;
if (GNUNET_YES == loss)
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
return;
GNUNET_assert (GNUNET_NO == h->do_destroy); /* Don't call twice. */
if ( (sync_first) &&
- (0 != GNUNET_MQ_get_length (h->mq)) &&
- (GNUNET_YES == try_connect (h)) )
+ (NULL != h->mq) &&
+ (0 != GNUNET_MQ_get_length (h->mq)) )
{
if ( (NULL != h->current) &&
(ACTION_GET == h->current->type) )
{
next = pos->next;
if ( (ACTION_GET == pos->type) ||
- (ACTION_WATCH == pos->type) ||
- (GNUNET_NO == pos->make_persistent) )
+ (ACTION_WATCH == pos->type) )
{
GNUNET_CONTAINER_DLL_remove (h->action_head,
h->action_tail,
reconnect_later (h);
return;
}
- if (0 < GNUNET_MQ_get_length (h->mq) )
- return; /* Wait for queue to be reduced more */
+ if (0 < GNUNET_MQ_get_length (h->mq))
+ return; /* Wait for queue to be reduced more */
/* schedule next action */
while (NULL == h->current)
{
"Notifying service that we are done\n");
h->do_destroy = GNUNET_SYSERR; /* in 'TEST' mode */
env = GNUNET_MQ_msg (hdr,
- GNUNET_MESSAGE_TYPE_TEST);
+ GNUNET_MESSAGE_TYPE_STATISTICS_DISCONNECT);
GNUNET_MQ_notify_sent (env,
&schedule_action,
h);
slen1 = strlen (subsystem) + 1;
slen2 = strlen (name) + 1;
GNUNET_assert (slen1 + slen2 + sizeof (struct GNUNET_MessageHeader) <
- GNUNET_SERVER_MAX_MESSAGE_SIZE);
+ GNUNET_MAX_MESSAGE_SIZE);
ai = GNUNET_new (struct GNUNET_STATISTICS_GetHandle);
ai->sh = handle;
ai->subsystem = GNUNET_strdup (subsystem);
continue;
if ( (w->proc == proc) &&
(w->proc_cls == proc_cls) &&
- (0 == strcmp (w->name, name)) &&
- (0 == strcmp (w->subsystem, subsystem)) )
+ (0 == strcmp (w->name,
+ name)) &&
+ (0 == strcmp (w->subsystem,
+ subsystem)) )
{
GNUNET_free (w->name);
GNUNET_free (w->subsystem);
slen = strlen (h->subsystem) + 1;
nlen = strlen (name) + 1;
nsize = sizeof (struct GNUNET_STATISTICS_SetMessage) + slen + nlen;
- if (nsize >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ if (nsize >= GNUNET_MAX_MESSAGE_SIZE)
{
GNUNET_break (0);
return;
}
for (ai = h->action_head; NULL != ai; ai = ai->next)
{
- if (! ( (0 == strcmp (ai->subsystem, h->subsystem)) &&
- (0 == strcmp (ai->name, name)) &&
+ if (! ( (0 == strcmp (ai->subsystem,
+ h->subsystem)) &&
+ (0 == strcmp (ai->name,
+ name)) &&
( (ACTION_UPDATE == ai->type) ||
(ACTION_SET == ai->type) ) ) )
continue;
ai->type = type;
}
}
- ai->timeout = GNUNET_TIME_relative_to_absolute (SET_TRANSMIT_TIMEOUT);
- ai->make_persistent = make_persistent;
+ ai->timeout
+ = GNUNET_TIME_relative_to_absolute (SET_TRANSMIT_TIMEOUT);
+ ai->make_persistent
+ = make_persistent;
return;
}
/* no existing entry matches, create a fresh one */