summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2017-10-05 17:11:17 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2017-10-05 17:11:17 +0200
commit2b0c260c3ceab5b2d5a4c3a04f7e2a0a357e9d75 (patch)
tree1d2c15ff0d1a587c16ce79de5a87b5baf3ba472b /src/util
parentca10195d9af33c557b57f16b8bb93df1066ab0ee (diff)
parent664aca2d29b15dd75967d2bb0298caf750993b6f (diff)
downloadgnunet-2b0c260c3ceab5b2d5a4c3a04f7e2a0a357e9d75.tar.gz
gnunet-2b0c260c3ceab5b2d5a4c3a04f7e2a0a357e9d75.zip
Merge remote-tracking branch 'origin/master' into identity_abe
Diffstat (limited to 'src/util')
-rw-r--r--src/util/.gitignore1
-rw-r--r--src/util/network.c16
-rw-r--r--src/util/scheduler.c14
3 files changed, 20 insertions, 11 deletions
diff --git a/src/util/.gitignore b/src/util/.gitignore
index 3576a2134..d32a66833 100644
--- a/src/util/.gitignore
+++ b/src/util/.gitignore
@@ -67,3 +67,4 @@ test_socks.nc
67perf_crypto_asymmetric 67perf_crypto_asymmetric
68perf_crypto_hash 68perf_crypto_hash
69perf_crypto_symmetric 69perf_crypto_symmetric
70perf_crypto_rsa
diff --git a/src/util/network.c b/src/util/network.c
index 66a468e45..942288613 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -1793,10 +1793,18 @@ GNUNET_NETWORK_socket_select (struct GNUNET_NETWORK_FDSet *rfds,
1793 _("Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n"), 1793 _("Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n"),
1794 "select"); 1794 "select");
1795 } 1795 }
1796 tv.tv_sec = timeout.rel_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us; 1796 if (timeout.rel_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us > (unsigned long long) LONG_MAX)
1797 tv.tv_usec = 1797 {
1798 (timeout.rel_value_us - 1798 tv.tv_sec = LONG_MAX;
1799 (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us)); 1799 tv.tv_usec = 999999L;
1800 }
1801 else
1802 {
1803 tv.tv_sec = (long) (timeout.rel_value_us / GNUNET_TIME_UNIT_SECONDS.rel_value_us);
1804 tv.tv_usec =
1805 (timeout.rel_value_us -
1806 (tv.tv_sec * GNUNET_TIME_UNIT_SECONDS.rel_value_us));
1807 }
1800 return select (nfds, 1808 return select (nfds,
1801 (NULL != rfds) ? &rfds->sds : NULL, 1809 (NULL != rfds) ? &rfds->sds : NULL,
1802 (NULL != wfds) ? &wfds->sds : NULL, 1810 (NULL != wfds) ? &wfds->sds : NULL,
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index a7b1d8e2a..e9c25d68a 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -73,7 +73,7 @@
73 * Argument to be passed from the driver to 73 * Argument to be passed from the driver to
74 * #GNUNET_SCHEDULER_run_from_driver(). Contains the 74 * #GNUNET_SCHEDULER_run_from_driver(). Contains the
75 * scheduler's internal state. 75 * scheduler's internal state.
76 */ 76 */
77struct GNUNET_SCHEDULER_Handle 77struct GNUNET_SCHEDULER_Handle
78{ 78{
79 /** 79 /**
@@ -94,7 +94,7 @@ struct GNUNET_SCHEDULER_Handle
94 * Driver we used for the event loop. 94 * Driver we used for the event loop.
95 */ 95 */
96 const struct GNUNET_SCHEDULER_Driver *driver; 96 const struct GNUNET_SCHEDULER_Driver *driver;
97 97
98}; 98};
99 99
100 100
@@ -127,7 +127,7 @@ struct GNUNET_SCHEDULER_Task
127 * Handle to the scheduler's state. 127 * Handle to the scheduler's state.
128 */ 128 */
129 const struct GNUNET_SCHEDULER_Handle *sh; 129 const struct GNUNET_SCHEDULER_Handle *sh;
130 130
131 /** 131 /**
132 * Set of file descriptors this task is waiting 132 * Set of file descriptors this task is waiting
133 * for for reading. Once ready, this is updated 133 * for for reading. Once ready, this is updated
@@ -172,7 +172,7 @@ struct GNUNET_SCHEDULER_Task
172 * Size of the @e fds array. 172 * Size of the @e fds array.
173 */ 173 */
174 unsigned int fds_len; 174 unsigned int fds_len;
175 175
176 /** 176 /**
177 * Why is the task ready? Set after task is added to ready queue. 177 * Why is the task ready? Set after task is added to ready queue.
178 * Initially set to zero. All reasons that have already been 178 * Initially set to zero. All reasons that have already been
@@ -1849,7 +1849,7 @@ GNUNET_SCHEDULER_task_ready (struct GNUNET_SCHEDULER_Task *task,
1849 * 1849 *
1850 * @param sh scheduler handle that was given to the `loop` 1850 * @param sh scheduler handle that was given to the `loop`
1851 * @return #GNUNET_OK if there are more tasks that are ready, 1851 * @return #GNUNET_OK if there are more tasks that are ready,
1852 * and thus we would like to run more (yield to avoid 1852 * and thus we would like to run more (yield to avoid
1853 * blocking other activities for too long) 1853 * blocking other activities for too long)
1854 * #GNUNET_NO if we are done running tasks (yield to block) 1854 * #GNUNET_NO if we are done running tasks (yield to block)
1855 * #GNUNET_SYSERR on error 1855 * #GNUNET_SYSERR on error
@@ -1876,11 +1876,11 @@ GNUNET_SCHEDULER_run_from_driver (struct GNUNET_SCHEDULER_Handle *sh)
1876 pending_timeout_last = NULL; 1876 pending_timeout_last = NULL;
1877 queue_ready_task (pos); 1877 queue_ready_task (pos);
1878 } 1878 }
1879 1879
1880 if (0 == ready_count) 1880 if (0 == ready_count)
1881 return GNUNET_NO; 1881 return GNUNET_NO;
1882 1882
1883 /* find out which task priority level we are going to 1883 /* find out which task priority level we are going to
1884 process this time */ 1884 process this time */
1885 max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP; 1885 max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP;
1886 GNUNET_assert (NULL == ready_head[GNUNET_SCHEDULER_PRIORITY_KEEP]); 1886 GNUNET_assert (NULL == ready_head[GNUNET_SCHEDULER_PRIORITY_KEEP]);