- case GNUNET_MESSAGE_TYPE_TEST:
- if (GNUNET_SYSERR != h->do_destroy)
- {
- /* not in shutdown, why do we get 'TEST'? */
- GNUNET_break (0);
- do_disconnect (h);
- reconnect_later (h);
- return;
- }
- h->do_destroy = GNUNET_NO;
- GNUNET_SCHEDULER_add_continuation (&destroy_task, h,
- GNUNET_SCHEDULER_REASON_PREREQ_DONE);
- break;
- case GNUNET_MESSAGE_TYPE_STATISTICS_END:
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Received end of statistics marker\n");
- if (NULL == (c = h->current))
- {
- GNUNET_break (0);
- do_disconnect (h);
- reconnect_later (h);
- return;
- }
- h->backoff = GNUNET_TIME_UNIT_MILLISECONDS;
- if (h->watches_size > 0)
- {
- GNUNET_CLIENT_receive (h->client, &receive_stats, h,
- GNUNET_TIME_UNIT_FOREVER_REL);
- }
- else
- {
- h->receiving = GNUNET_NO;
- }
- h->current = NULL;
- schedule_action (h);
- if (NULL != c->cont)
- {
- c->cont (c->cls, GNUNET_OK);
- c->cont = NULL;
- }
- free_action_item (c);
- return;
- case GNUNET_MESSAGE_TYPE_STATISTICS_VALUE:
- if (GNUNET_OK != process_statistics_value_message (h, msg))
- {
- do_disconnect (h);
- reconnect_later (h);
- return;
- }
- /* finally, look for more! */
- LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Processing VALUE done, now reading more\n");
- GNUNET_CLIENT_receive (h->client, &receive_stats, h,
- GNUNET_TIME_absolute_get_remaining (h->
- current->timeout));
- h->backoff = GNUNET_TIME_UNIT_MILLISECONDS;
- return;
- case GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE:
- if (GNUNET_OK !=
- (ret = process_watch_value (h, msg)))
- {
- do_disconnect (h);
- if (GNUNET_NO == ret)
- h->backoff = GNUNET_TIME_UNIT_MILLISECONDS;
- reconnect_later (h);
- return;
- }
- h->backoff = GNUNET_TIME_UNIT_MILLISECONDS;
- GNUNET_assert (h->watches_size > 0);
- GNUNET_CLIENT_receive (h->client, &receive_stats, h,
- GNUNET_TIME_UNIT_FOREVER_REL);
- return;
- default:
- GNUNET_break (0);
- do_disconnect (h);
- reconnect_later (h);
+ /* So we are shutting down and the service is not reachable.
+ * Chances are that it's down for good and we are not going to connect to
+ * it anymore.
+ * Give up and don't sync the rest of the data.
+ */
+ loss = GNUNET_NO;
+ for (gh = h->action_head; NULL != gh; gh = gh->next)
+ if ( (gh->make_persistent) &&
+ (ACTION_SET == gh->type) )
+ loss = GNUNET_YES;
+ if (GNUNET_YES == loss)
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Could not save some persistent statistics\n"));
+ if (NULL != h->destroy_task)
+ GNUNET_SCHEDULER_cancel (h->destroy_task);
+ h->destroy_task = GNUNET_SCHEDULER_add_now (&do_destroy,
+ h);