if (NULL != handle->name)
GNUNET_free (handle->name);
if (NULL != handle->timeout_task)
+ {
GNUNET_SCHEDULER_cancel (handle->timeout_task);
+ handle->timeout_task = NULL;
+ }
if (NULL != handle->identity_handle)
GNUNET_IDENTITY_disconnect (handle->identity_handle);
if (NULL != handle->subsys)
static void
run_mhd_now ()
{
- if (NULL !=
- httpd_task)
+ if (NULL != httpd_task)
+ {
GNUNET_SCHEDULER_cancel (httpd_task);
+ httpd_task = NULL;
+ }
httpd_task = GNUNET_SCHEDULER_add_now (&do_httpd,
NULL);
+
}
/**
GNUNET_SCHEDULER_cancel (ltask6);
ltask6 = NULL;
}
-}
+
+ if (NULL != lsock4)
+ {
+ GNUNET_NETWORK_socket_close (lsock4);
+ lsock4 = NULL;
+ }
+ if (NULL != lsock6)
+ {
+ GNUNET_NETWORK_socket_close (lsock6);
+ lsock6 = NULL;
+ }
+ }
/**
wws = NULL;
}
if (NULL != httpd_task)
+ {
GNUNET_SCHEDULER_cancel (httpd_task);
+ httpd_task = NULL;
+ }
if ( (MHD_YES == haveto) ||
(-1 != max))
{
GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
tv, wrs, wws,
&do_httpd, NULL);
+
}
if (NULL != wrs)
GNUNET_NETWORK_fdset_destroy (wrs);
const struct sockaddr *addr;
socklen_t len;
+ GNUNET_assert (NULL != lsock);
if (lsock == lsock4)
- ltask4 = NULL;
- else
- ltask6 = NULL;
- if (lsock == lsock4)
+ {
ltask4 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
lsock,
&do_accept, lsock);
- else
+
+ }
+ else if (lsock == lsock6)
+ {
ltask6 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
lsock,
&do_accept, lsock);
+
+ }
+ else
+ GNUNET_assert (0);
s = GNUNET_NETWORK_socket_accept (lsock, NULL, NULL);
if (NULL == s)
{
{
ltask6 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
lsock6, &do_accept, lsock6);
+
}
}
lsock4 = bind_v4 ();
{
ltask4 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
lsock4, &do_accept, lsock4);
+
}
}
if ( (NULL == lsock4) &&
{
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_option_ulong ('p',
- "port",
- "PORT",
- gettext_noop ("listen on specified port (default: 7776)"),
- &port),
+ "port",
+ "PORT",
+ gettext_noop ("listen on specified port (default: 7776)"),
+ &port),
GNUNET_GETOPT_OPTION_END
};
static const char* err_page =
if (GNUNET_OK != del_result)
{
LOG (GNUNET_ERROR_TYPE_ERROR,
- "driver could not delete task\n");
+ "driver could not delete task %p\n", pos);
GNUNET_assert (0);
}
}
context = cls;
ret = GNUNET_SYSERR;
pos = context->scheduled_head;
+ if (0 == task->fds_len)
+ return GNUNET_OK;
while (NULL != pos)
{
struct Scheduled *next = pos->next;