aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlurchi <lurchi@strangeplace.net>2017-08-11 19:02:16 +0200
committerlurchi <lurchi@strangeplace.net>2017-08-11 19:02:22 +0200
commit848358d875f9c246de451818b456219eb0bf6408 (patch)
tree0c17a64c9be35d9c730e8d767f0a7a93f3d280cb /src
parent7d42c453fbb032ac8fb43c8e56bb84354ecedf2d (diff)
downloadgnunet-848358d875f9c246de451818b456219eb0bf6408.tar.gz
gnunet-848358d875f9c246de451818b456219eb0bf6408.zip
Revert "set fds_len in all cases; call set_wakeup only in two places"
This reverts commit 7d42c453fbb032ac8fb43c8e56bb84354ecedf2d.
Diffstat (limited to 'src')
-rw-r--r--src/testbed/gnunet-helper-testbed.c6
-rw-r--r--src/util/scheduler.c17
2 files changed, 9 insertions, 14 deletions
diff --git a/src/testbed/gnunet-helper-testbed.c b/src/testbed/gnunet-helper-testbed.c
index 5a5cfa0d2..392f257dd 100644
--- a/src/testbed/gnunet-helper-testbed.c
+++ b/src/testbed/gnunet-helper-testbed.c
@@ -556,10 +556,6 @@ run (void *cls,
556 const char *cfgfile, 556 const char *cfgfile,
557 const struct GNUNET_CONFIGURATION_Handle *cfg) 557 const struct GNUNET_CONFIGURATION_Handle *cfg)
558{ 558{
559 FILE *f = FOPEN ("helper_output", "w");
560 FPRINTF (f, "run\n");
561 FCLOSE (f);
562
563 LOG_DEBUG ("Starting testbed helper...\n"); 559 LOG_DEBUG ("Starting testbed helper...\n");
564 tokenizer = GNUNET_MST_create (&tokenizer_cb, NULL); 560 tokenizer = GNUNET_MST_create (&tokenizer_cb, NULL);
565 stdin_fd = GNUNET_DISK_get_handle_from_native (stdin); 561 stdin_fd = GNUNET_DISK_get_handle_from_native (stdin);
@@ -608,8 +604,6 @@ main (int argc,
608 }; 604 };
609 int ret; 605 int ret;
610 606
611 //sleep (10);
612
613 status = GNUNET_OK; 607 status = GNUNET_OK;
614 if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, 608 if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO,
615 GNUNET_NO, GNUNET_NO))) 609 GNUNET_NO, GNUNET_NO)))
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index 89b6e41f3..ba4176a0a 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -722,7 +722,6 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
722 struct GNUNET_SCHEDULER_FdInfo read_fdi = {.fd = read_nh, .et = GNUNET_SCHEDULER_ET_IN, .sock = GNUNET_NETWORK_get_fd (read_nh)}; 722 struct GNUNET_SCHEDULER_FdInfo read_fdi = {.fd = read_nh, .et = GNUNET_SCHEDULER_ET_IN, .sock = GNUNET_NETWORK_get_fd (read_nh)};
723 t->fdx = read_fdi; 723 t->fdx = read_fdi;
724 t->fds = &t->fdx; 724 t->fds = &t->fdx;
725 t->fds_len = 1;
726 t->read_fd = t->fdx.sock; 725 t->read_fd = t->fdx.sock;
727 } 726 }
728 else if (NULL != write_nh) 727 else if (NULL != write_nh)
@@ -730,7 +729,6 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
730 struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fd = write_nh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = GNUNET_NETWORK_get_fd (write_nh)}; 729 struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fd = write_nh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = GNUNET_NETWORK_get_fd (write_nh)};
731 t->fdx = write_fdi; 730 t->fdx = write_fdi;
732 t->fds = &t->fdx; 731 t->fds = &t->fdx;
733 t->fds_len = 1;
734 t->write_fd = t->fdx.sock; 732 t->write_fd = t->fdx.sock;
735 } 733 }
736 else if (NULL != read_fh) 734 else if (NULL != read_fh)
@@ -738,7 +736,6 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
738 struct GNUNET_SCHEDULER_FdInfo read_fdi = {.fh = read_fh, .et = GNUNET_SCHEDULER_ET_IN, .sock = read_fh->fd}; 736 struct GNUNET_SCHEDULER_FdInfo read_fdi = {.fh = read_fh, .et = GNUNET_SCHEDULER_ET_IN, .sock = read_fh->fd};
739 t->fdx = read_fdi; 737 t->fdx = read_fdi;
740 t->fds = &t->fdx; 738 t->fds = &t->fdx;
741 t->fds_len = 1;
742 t->read_fd = t->fdx.sock; 739 t->read_fd = t->fdx.sock;
743 } 740 }
744 else if (NULL != write_fh) 741 else if (NULL != write_fh)
@@ -746,7 +743,6 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
746 struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fh = write_fh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = write_fh->fd}; 743 struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fh = write_fh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = write_fh->fd};
747 t->fdx = write_fdi; 744 t->fdx = write_fdi;
748 t->fds = &t->fdx; 745 t->fds = &t->fdx;
749 t->fds_len = 1;
750 t->write_fd = t->fdx.sock; 746 t->write_fd = t->fdx.sock;
751 } 747 }
752} 748}
@@ -819,6 +815,9 @@ GNUNET_SCHEDULER_cancel (struct GNUNET_SCHEDULER_Task *task)
819 task); 815 task);
820 if (pending_timeout_last == task) 816 if (pending_timeout_last == task)
821 pending_timeout_last = NULL; 817 pending_timeout_last = NULL;
818 else
819 scheduler_driver->set_wakeup (scheduler_driver->cls,
820 get_timeout ());
822 } 821 }
823 //TODO check if this is redundant 822 //TODO check if this is redundant
824 if (task == pending_timeout_last) 823 if (task == pending_timeout_last)
@@ -952,6 +951,8 @@ GNUNET_SCHEDULER_add_at_with_priority (struct GNUNET_TIME_Absolute at,
952 GNUNET_CONTAINER_DLL_insert (pending_timeout_head, 951 GNUNET_CONTAINER_DLL_insert (pending_timeout_head,
953 pending_timeout_tail, 952 pending_timeout_tail,
954 t); 953 t);
954 scheduler_driver->set_wakeup (scheduler_driver->cls,
955 at);
955 } 956 }
956 else 957 else
957 { 958 {
@@ -1259,6 +1260,8 @@ add_without_sets (struct GNUNET_TIME_Relative delay,
1259 pending_tail, 1260 pending_tail,
1260 t); 1261 t);
1261 scheduler_multi_function_call(t, scheduler_driver->add); 1262 scheduler_multi_function_call(t, scheduler_driver->add);
1263 scheduler_driver->set_wakeup (scheduler_driver->cls,
1264 get_timeout ());
1262 max_priority_added = GNUNET_MAX (max_priority_added, 1265 max_priority_added = GNUNET_MAX (max_priority_added,
1263 t->priority); 1266 t->priority);
1264 LOG (GNUNET_ERROR_TYPE_DEBUG, 1267 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1582,6 +1585,8 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
1582 pending_tail, 1585 pending_tail,
1583 t); 1586 t);
1584 scheduler_multi_function_call(t, scheduler_driver->add); 1587 scheduler_multi_function_call(t, scheduler_driver->add);
1588 scheduler_driver->set_wakeup (scheduler_driver->cls,
1589 get_timeout ());
1585 max_priority_added = GNUNET_MAX (max_priority_added, 1590 max_priority_added = GNUNET_MAX (max_priority_added,
1586 t->priority); 1591 t->priority);
1587 LOG (GNUNET_ERROR_TYPE_DEBUG, 1592 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1620,7 +1625,6 @@ GNUNET_SCHEDULER_task_ready (struct GNUNET_SCHEDULER_Task *task,
1620 (0 != (GNUNET_SCHEDULER_ET_OUT & et)) ) 1625 (0 != (GNUNET_SCHEDULER_ET_OUT & et)) )
1621 reason |= GNUNET_SCHEDULER_REASON_WRITE_READY; 1626 reason |= GNUNET_SCHEDULER_REASON_WRITE_READY;
1622 reason |= GNUNET_SCHEDULER_REASON_PREREQ_DONE; 1627 reason |= GNUNET_SCHEDULER_REASON_PREREQ_DONE;
1623 GNUNET_assert (1 == task->fds_len);
1624 task->reason = reason; 1628 task->reason = reason;
1625 task->fds = &task->fdx; // FIXME: if task contains a list of fds, this is wrong! 1629 task->fds = &task->fdx; // FIXME: if task contains a list of fds, this is wrong!
1626 task->fdx.et = et; 1630 task->fdx.et = et;
@@ -1832,8 +1836,6 @@ GNUNET_SCHEDULER_run_with_driver (const struct GNUNET_SCHEDULER_Driver *driver,
1832 GNUNET_SCHEDULER_REASON_STARTUP, 1836 GNUNET_SCHEDULER_REASON_STARTUP,
1833 GNUNET_SCHEDULER_PRIORITY_DEFAULT); 1837 GNUNET_SCHEDULER_PRIORITY_DEFAULT);
1834 active_task = NULL; 1838 active_task = NULL;
1835 scheduler_driver->set_wakeup (scheduler_driver->cls,
1836 get_timeout ());
1837 /* begin main event loop */ 1839 /* begin main event loop */
1838 sh.rs = GNUNET_NETWORK_fdset_create (); 1840 sh.rs = GNUNET_NETWORK_fdset_create ();
1839 sh.ws = GNUNET_NETWORK_fdset_create (); 1841 sh.ws = GNUNET_NETWORK_fdset_create ();
@@ -1856,7 +1858,6 @@ GNUNET_SCHEDULER_run_with_driver (const struct GNUNET_SCHEDULER_Driver *driver,
1856#endif 1858#endif
1857 GNUNET_DISK_pipe_close (shutdown_pipe_handle); 1859 GNUNET_DISK_pipe_close (shutdown_pipe_handle);
1858 shutdown_pipe_handle = NULL; 1860 shutdown_pipe_handle = NULL;
1859 scheduler_driver = NULL;
1860 return ret; 1861 return ret;
1861} 1862}
1862 1863