[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 21/45: set fds_len in all cases; call set_wakeup o
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 21/45: set fds_len in all cases; call set_wakeup only in two places |
Date: |
Sun, 31 Dec 2017 00:37:08 +0100 |
This is an automated email from the git hooks/post-receive script.
lurchi pushed a commit to branch master
in repository gnunet.
commit 7d42c453fbb032ac8fb43c8e56bb84354ecedf2d
Author: lurchi <address@hidden>
AuthorDate: Fri Aug 11 18:49:55 2017 +0200
set fds_len in all cases; call set_wakeup only in two places
---
src/testbed/gnunet-helper-testbed.c | 6 ++++++
src/util/scheduler.c | 17 ++++++++---------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/src/testbed/gnunet-helper-testbed.c
b/src/testbed/gnunet-helper-testbed.c
index 392f257dd..5a5cfa0d2 100644
--- a/src/testbed/gnunet-helper-testbed.c
+++ b/src/testbed/gnunet-helper-testbed.c
@@ -556,6 +556,10 @@ run (void *cls,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
+ FILE *f = FOPEN ("helper_output", "w");
+ FPRINTF (f, "run\n");
+ FCLOSE (f);
+
LOG_DEBUG ("Starting testbed helper...\n");
tokenizer = GNUNET_MST_create (&tokenizer_cb, NULL);
stdin_fd = GNUNET_DISK_get_handle_from_native (stdin);
@@ -604,6 +608,8 @@ main (int argc,
};
int ret;
+ //sleep (10);
+
status = GNUNET_OK;
if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO,
GNUNET_NO, GNUNET_NO)))
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index ba4176a0a..89b6e41f3 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -722,6 +722,7 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
struct GNUNET_SCHEDULER_FdInfo read_fdi = {.fd = read_nh, .et =
GNUNET_SCHEDULER_ET_IN, .sock = GNUNET_NETWORK_get_fd (read_nh)};
t->fdx = read_fdi;
t->fds = &t->fdx;
+ t->fds_len = 1;
t->read_fd = t->fdx.sock;
}
else if (NULL != write_nh)
@@ -729,6 +730,7 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fd = write_nh, .et =
GNUNET_SCHEDULER_ET_OUT, .sock = GNUNET_NETWORK_get_fd (write_nh)};
t->fdx = write_fdi;
t->fds = &t->fdx;
+ t->fds_len = 1;
t->write_fd = t->fdx.sock;
}
else if (NULL != read_fh)
@@ -736,6 +738,7 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
struct GNUNET_SCHEDULER_FdInfo read_fdi = {.fh = read_fh, .et =
GNUNET_SCHEDULER_ET_IN, .sock = read_fh->fd};
t->fdx = read_fdi;
t->fds = &t->fdx;
+ t->fds_len = 1;
t->read_fd = t->fdx.sock;
}
else if (NULL != write_fh)
@@ -743,6 +746,7 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fh = write_fh, .et =
GNUNET_SCHEDULER_ET_OUT, .sock = write_fh->fd};
t->fdx = write_fdi;
t->fds = &t->fdx;
+ t->fds_len = 1;
t->write_fd = t->fdx.sock;
}
}
@@ -815,9 +819,6 @@ GNUNET_SCHEDULER_cancel (struct GNUNET_SCHEDULER_Task *task)
task);
if (pending_timeout_last == task)
pending_timeout_last = NULL;
- else
- scheduler_driver->set_wakeup (scheduler_driver->cls,
- get_timeout ());
}
//TODO check if this is redundant
if (task == pending_timeout_last)
@@ -951,8 +952,6 @@ GNUNET_SCHEDULER_add_at_with_priority (struct
GNUNET_TIME_Absolute at,
GNUNET_CONTAINER_DLL_insert (pending_timeout_head,
pending_timeout_tail,
t);
- scheduler_driver->set_wakeup (scheduler_driver->cls,
- at);
}
else
{
@@ -1260,8 +1259,6 @@ add_without_sets (struct GNUNET_TIME_Relative delay,
pending_tail,
t);
scheduler_multi_function_call(t, scheduler_driver->add);
- scheduler_driver->set_wakeup (scheduler_driver->cls,
- get_timeout ());
max_priority_added = GNUNET_MAX (max_priority_added,
t->priority);
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1585,8 +1582,6 @@ GNUNET_SCHEDULER_add_select (enum
GNUNET_SCHEDULER_Priority prio,
pending_tail,
t);
scheduler_multi_function_call(t, scheduler_driver->add);
- scheduler_driver->set_wakeup (scheduler_driver->cls,
- get_timeout ());
max_priority_added = GNUNET_MAX (max_priority_added,
t->priority);
LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1625,6 +1620,7 @@ GNUNET_SCHEDULER_task_ready (struct GNUNET_SCHEDULER_Task
*task,
(0 != (GNUNET_SCHEDULER_ET_OUT & et)) )
reason |= GNUNET_SCHEDULER_REASON_WRITE_READY;
reason |= GNUNET_SCHEDULER_REASON_PREREQ_DONE;
+ GNUNET_assert (1 == task->fds_len);
task->reason = reason;
task->fds = &task->fdx; // FIXME: if task contains a list of fds, this is
wrong!
task->fdx.et = et;
@@ -1836,6 +1832,8 @@ GNUNET_SCHEDULER_run_with_driver (const struct
GNUNET_SCHEDULER_Driver *driver,
GNUNET_SCHEDULER_REASON_STARTUP,
GNUNET_SCHEDULER_PRIORITY_DEFAULT);
active_task = NULL;
+ scheduler_driver->set_wakeup (scheduler_driver->cls,
+ get_timeout ());
/* begin main event loop */
sh.rs = GNUNET_NETWORK_fdset_create ();
sh.ws = GNUNET_NETWORK_fdset_create ();
@@ -1858,6 +1856,7 @@ GNUNET_SCHEDULER_run_with_driver (const struct
GNUNET_SCHEDULER_Driver *driver,
#endif
GNUNET_DISK_pipe_close (shutdown_pipe_handle);
shutdown_pipe_handle = NULL;
+ scheduler_driver = NULL;
return ret;
}
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] 25/45: fix off-by-one error that prevented reading from stdin, (continued)
- [GNUnet-SVN] [gnunet] 25/45: fix off-by-one error that prevented reading from stdin, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 36/45: fix behaviour of GNUNET_SCHEDULER_add_select on empty fdsets, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 39/45: Don't consider restart when the test action already finished, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 35/45: NULL-initialize array pointers, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 34/45: cleanup, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 28/45: increasing length variable is already done by GNUNET_xgrow_ (called by the GNUNET_array_append macro), gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 31/45: improve documentation about the GNUNET_array_append and GNUNET_array_grow macros, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 22/45: Revert "set fds_len in all cases; call set_wakeup only in two places", gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 33/45: GNUNET_SCHEDULER_check_lifeness not needed anymore, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 23/45: set fds_len in all cases; call set_wakeup only in two places, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 21/45: set fds_len in all cases; call set_wakeup only in two places,
gnunet <=
- [GNUnet-SVN] [gnunet] 38/45: clarify documentation about adding / deleting tasks, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 12/45: separate the select driver's fd sets from the driver-internal fdsets, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 40/45: Remove busy waiting checks, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 29/45: implement bookkeeping about which FDs related to a tasks have been marked ready (required API change in GNUNET_SCHEDULER_task_ready), gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 45/45: merge branch 'refactoring-scheduler', gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 26/45: reimplement init_fd_info as preparation for refactoring GNUNET_SCHEDULER_add_select, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 24/45: init_fd_info now completely initializes fd information; Allow calling add/cancel functions only when the scheduler is running, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 42/45: handles, not handlers, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 30/45: only allocate network / file handles and store them in the task when GNUNET_SCHEDULER_add_select is used, gnunet, 2017/12/30
- [GNUnet-SVN] [gnunet] 43/45: Fix select loop running conditions, gnunet, 2017/12/30