[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: fix scheduler when add_sele
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: fix scheduler when add_select is called with 0 ready fds |
Date: |
Wed, 10 Jan 2018 04:29:14 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 16f04cf4f fix scheduler when add_select is called with 0 ready fds
16f04cf4f is described below
commit 16f04cf4fb1a7b489b3672d19818ffd1fd8d57f1
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Wed Jan 10 04:29:06 2018 +0100
fix scheduler when add_select is called with 0 ready fds
---
src/identity/plugin_rest_identity.c | 3 +++
src/rest/gnunet-rest-server.c | 49 ++++++++++++++++++++++++++++---------
src/util/scheduler.c | 4 ++-
3 files changed, 43 insertions(+), 13 deletions(-)
diff --git a/src/identity/plugin_rest_identity.c
b/src/identity/plugin_rest_identity.c
index 33804143d..6044d0641 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -241,7 +241,10 @@ cleanup_handle (struct RequestHandle *handle)
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)
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c
index 5b92c6c43..b08aee389 100644
--- a/src/rest/gnunet-rest-server.c
+++ b/src/rest/gnunet-rest-server.c
@@ -154,11 +154,14 @@ do_httpd (void *cls);
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);
+
}
/**
@@ -410,7 +413,18 @@ kill_httpd ()
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;
+ }
+ }
/**
@@ -460,7 +474,10 @@ schedule_httpd ()
wws = NULL;
}
if (NULL != httpd_task)
+ {
GNUNET_SCHEDULER_cancel (httpd_task);
+ httpd_task = NULL;
+ }
if ( (MHD_YES == haveto) ||
(-1 != max))
{
@@ -468,6 +485,7 @@ schedule_httpd ()
GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
tv, wrs, wws,
&do_httpd, NULL);
+
}
if (NULL != wrs)
GNUNET_NETWORK_fdset_destroy (wrs);
@@ -504,18 +522,23 @@ do_accept (void *cls)
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)
{
@@ -720,6 +743,7 @@ run (void *cls,
{
ltask6 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
lsock6, &do_accept, lsock6);
+
}
}
lsock4 = bind_v4 ();
@@ -739,6 +763,7 @@ run (void *cls,
{
ltask4 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
lsock4, &do_accept, lsock4);
+
}
}
if ( (NULL == lsock4) &&
@@ -785,10 +810,10 @@ main (int argc, char *const *argv)
{
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 =
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index 9d37231e7..c2061b50f 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -2006,7 +2006,7 @@ GNUNET_SCHEDULER_run_from_driver (struct
GNUNET_SCHEDULER_Handle *sh)
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);
}
}
@@ -2187,6 +2187,8 @@ select_del (void *cls,
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;
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: fix scheduler when add_select is called with 0 ready fds,
gnunet <=