if (tcc->tc != NULL)
tcc->tc (tcc->tc_cls, GNUNET_SYSERR);
if (GNUNET_YES == tcc->end)
- {
- GNUNET_SERVER_receive_done (tcc->client, GNUNET_SYSERR);
- }
+ GNUNET_SERVER_receive_done (tcc->client, GNUNET_SYSERR);
+ GNUNET_SERVER_client_drop (tcc->client);
GNUNET_free (tcc->msg);
GNUNET_free (tcc);
return 0;
"Response transmitted, more pending!\n");
#endif
}
+ GNUNET_SERVER_client_drop (tcc->client);
GNUNET_free (tcc->msg);
GNUNET_free (tcc);
return msize;
tcc->end = end;
if (NULL ==
(tcc->th = GNUNET_SERVER_notify_transmit_ready (client,
- ntohs(msg->size),
- GNUNET_TIME_UNIT_FOREVER_REL,
- &transmit_callback,
+ ntohs(msg->size),
+ GNUNET_TIME_UNIT_FOREVER_REL,
+ &transmit_callback,
tcc)))
{
GNUNET_break (0);
tc (tc_cls, GNUNET_SYSERR);
GNUNET_free (msg);
GNUNET_free (tcc);
+ return;
}
+ GNUNET_SERVER_client_keep (client);
GNUNET_CONTAINER_DLL_insert (tcc_head,
tcc_tail,
tcc);
}
+/**
+ * Final task run after shutdown. Unloads plugins and disconnects us from
+ * statistics.
+ */
+static void
+unload_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ unload_plugin (plugin);
+ plugin = NULL;
+ if (filter != NULL)
+ {
+ GNUNET_CONTAINER_bloomfilter_free (filter);
+ filter = NULL;
+ }
+ GNUNET_ARM_stop_services (cfg, tc->sched, "statistics", NULL);
+}
+
+
/**
* Last task run during shutdown. Disconnects us from
* the transport and core.
expired_kill_task);
expired_kill_task = GNUNET_SCHEDULER_NO_TASK;
}
- unload_plugin (plugin);
- plugin = NULL;
- if (filter != NULL)
- {
- GNUNET_CONTAINER_bloomfilter_free (filter);
- filter = NULL;
- }
- GNUNET_ARM_stop_services (cfg, tc->sched, "statistics", NULL);
+ GNUNET_SCHEDULER_add_continuation (sched,
+ &unload_task,
+ NULL,
+ GNUNET_SCHEDULER_REASON_PREREQ_DONE);
}