aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlurchi <lurchi@strangeplace.net>2017-08-11 18:57:20 +0200
committerlurchi <lurchi@strangeplace.net>2017-08-11 19:03:39 +0200
commit7289071d2aa0e5795e78d3dd0433f82dde7d90ac (patch)
tree4f2c09cf50cbb951fa0eafab7500073e384d1279 /src
parent848358d875f9c246de451818b456219eb0bf6408 (diff)
downloadgnunet-7289071d2aa0e5795e78d3dd0433f82dde7d90ac.tar.gz
gnunet-7289071d2aa0e5795e78d3dd0433f82dde7d90ac.zip
set fds_len in all cases; call set_wakeup only in two places
Diffstat (limited to 'src')
-rw-r--r--src/util/scheduler.c17
1 files changed, 8 insertions, 9 deletions
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,
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;
725 t->read_fd = t->fdx.sock; 726 t->read_fd = t->fdx.sock;
726 } 727 }
727 else if (NULL != write_nh) 728 else if (NULL != write_nh)
@@ -729,6 +730,7 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
729 struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fd = write_nh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = GNUNET_NETWORK_get_fd (write_nh)}; 730 struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fd = write_nh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = GNUNET_NETWORK_get_fd (write_nh)};
730 t->fdx = write_fdi; 731 t->fdx = write_fdi;
731 t->fds = &t->fdx; 732 t->fds = &t->fdx;
733 t->fds_len = 1;
732 t->write_fd = t->fdx.sock; 734 t->write_fd = t->fdx.sock;
733 } 735 }
734 else if (NULL != read_fh) 736 else if (NULL != read_fh)
@@ -736,6 +738,7 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
736 struct GNUNET_SCHEDULER_FdInfo read_fdi = {.fh = read_fh, .et = GNUNET_SCHEDULER_ET_IN, .sock = read_fh->fd}; 738 struct GNUNET_SCHEDULER_FdInfo read_fdi = {.fh = read_fh, .et = GNUNET_SCHEDULER_ET_IN, .sock = read_fh->fd};
737 t->fdx = read_fdi; 739 t->fdx = read_fdi;
738 t->fds = &t->fdx; 740 t->fds = &t->fdx;
741 t->fds_len = 1;
739 t->read_fd = t->fdx.sock; 742 t->read_fd = t->fdx.sock;
740 } 743 }
741 else if (NULL != write_fh) 744 else if (NULL != write_fh)
@@ -743,6 +746,7 @@ init_fd_info (struct GNUNET_SCHEDULER_Task *t,
743 struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fh = write_fh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = write_fh->fd}; 746 struct GNUNET_SCHEDULER_FdInfo write_fdi = {.fh = write_fh, .et = GNUNET_SCHEDULER_ET_OUT, .sock = write_fh->fd};
744 t->fdx = write_fdi; 747 t->fdx = write_fdi;
745 t->fds = &t->fdx; 748 t->fds = &t->fdx;
749 t->fds_len = 1;
746 t->write_fd = t->fdx.sock; 750 t->write_fd = t->fdx.sock;
747 } 751 }
748} 752}
@@ -815,9 +819,6 @@ GNUNET_SCHEDULER_cancel (struct GNUNET_SCHEDULER_Task *task)
815 task); 819 task);
816 if (pending_timeout_last == task) 820 if (pending_timeout_last == task)
817 pending_timeout_last = NULL; 821 pending_timeout_last = NULL;
818 else
819 scheduler_driver->set_wakeup (scheduler_driver->cls,
820 get_timeout ());
821 } 822 }
822 //TODO check if this is redundant 823 //TODO check if this is redundant
823 if (task == pending_timeout_last) 824 if (task == pending_timeout_last)
@@ -951,8 +952,6 @@ GNUNET_SCHEDULER_add_at_with_priority (struct GNUNET_TIME_Absolute at,
951 GNUNET_CONTAINER_DLL_insert (pending_timeout_head, 952 GNUNET_CONTAINER_DLL_insert (pending_timeout_head,
952 pending_timeout_tail, 953 pending_timeout_tail,
953 t); 954 t);
954 scheduler_driver->set_wakeup (scheduler_driver->cls,
955 at);
956 } 955 }
957 else 956 else
958 { 957 {
@@ -1260,8 +1259,6 @@ add_without_sets (struct GNUNET_TIME_Relative delay,
1260 pending_tail, 1259 pending_tail,
1261 t); 1260 t);
1262 scheduler_multi_function_call(t, scheduler_driver->add); 1261 scheduler_multi_function_call(t, scheduler_driver->add);
1263 scheduler_driver->set_wakeup (scheduler_driver->cls,
1264 get_timeout ());
1265 max_priority_added = GNUNET_MAX (max_priority_added, 1262 max_priority_added = GNUNET_MAX (max_priority_added,
1266 t->priority); 1263 t->priority);
1267 LOG (GNUNET_ERROR_TYPE_DEBUG, 1264 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1585,8 +1582,6 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
1585 pending_tail, 1582 pending_tail,
1586 t); 1583 t);
1587 scheduler_multi_function_call(t, scheduler_driver->add); 1584 scheduler_multi_function_call(t, scheduler_driver->add);
1588 scheduler_driver->set_wakeup (scheduler_driver->cls,
1589 get_timeout ());
1590 max_priority_added = GNUNET_MAX (max_priority_added, 1585 max_priority_added = GNUNET_MAX (max_priority_added,
1591 t->priority); 1586 t->priority);
1592 LOG (GNUNET_ERROR_TYPE_DEBUG, 1587 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1625,6 +1620,7 @@ GNUNET_SCHEDULER_task_ready (struct GNUNET_SCHEDULER_Task *task,
1625 (0 != (GNUNET_SCHEDULER_ET_OUT & et)) ) 1620 (0 != (GNUNET_SCHEDULER_ET_OUT & et)) )
1626 reason |= GNUNET_SCHEDULER_REASON_WRITE_READY; 1621 reason |= GNUNET_SCHEDULER_REASON_WRITE_READY;
1627 reason |= GNUNET_SCHEDULER_REASON_PREREQ_DONE; 1622 reason |= GNUNET_SCHEDULER_REASON_PREREQ_DONE;
1623 GNUNET_assert (1 == task->fds_len);
1628 task->reason = reason; 1624 task->reason = reason;
1629 task->fds = &task->fdx; // FIXME: if task contains a list of fds, this is wrong! 1625 task->fds = &task->fdx; // FIXME: if task contains a list of fds, this is wrong!
1630 task->fdx.et = et; 1626 task->fdx.et = et;
@@ -1836,6 +1832,8 @@ GNUNET_SCHEDULER_run_with_driver (const struct GNUNET_SCHEDULER_Driver *driver,
1836 GNUNET_SCHEDULER_REASON_STARTUP, 1832 GNUNET_SCHEDULER_REASON_STARTUP,
1837 GNUNET_SCHEDULER_PRIORITY_DEFAULT); 1833 GNUNET_SCHEDULER_PRIORITY_DEFAULT);
1838 active_task = NULL; 1834 active_task = NULL;
1835 scheduler_driver->set_wakeup (scheduler_driver->cls,
1836 get_timeout ());
1839 /* begin main event loop */ 1837 /* begin main event loop */
1840 sh.rs = GNUNET_NETWORK_fdset_create (); 1838 sh.rs = GNUNET_NETWORK_fdset_create ();
1841 sh.ws = GNUNET_NETWORK_fdset_create (); 1839 sh.ws = GNUNET_NETWORK_fdset_create ();
@@ -1858,6 +1856,7 @@ GNUNET_SCHEDULER_run_with_driver (const struct GNUNET_SCHEDULER_Driver *driver,
1858#endif 1856#endif
1859 GNUNET_DISK_pipe_close (shutdown_pipe_handle); 1857 GNUNET_DISK_pipe_close (shutdown_pipe_handle);
1860 shutdown_pipe_handle = NULL; 1858 shutdown_pipe_handle = NULL;
1859 scheduler_driver = NULL;
1861 return ret; 1860 return ret;
1862} 1861}
1863 1862