gnunet-svn
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]