[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated: -improve anastasis-gtk with han
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated: -improve anastasis-gtk with hanging provider: shorten timeout when applicable |
Date: |
Sun, 26 Jun 2022 16:24:43 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository anastasis.
The following commit(s) were added to refs/heads/master by this push:
new f02805c -improve anastasis-gtk with hanging provider: shorten timeout
when applicable
f02805c is described below
commit f02805c676d0ffbbd400c7a311477f14b8ecfe0f
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Jun 26 16:24:39 2022 +0200
-improve anastasis-gtk with hanging provider: shorten timeout when
applicable
---
src/reducer/anastasis_api_redux.c | 39 ++++++++++++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/src/reducer/anastasis_api_redux.c
b/src/reducer/anastasis_api_redux.c
index 8090e00..7554b06 100644
--- a/src/reducer/anastasis_api_redux.c
+++ b/src/reducer/anastasis_api_redux.c
@@ -137,6 +137,16 @@ struct ConfigRequest
*/
struct ConfigReduxWaiting *w_tail;
+ /**
+ * When did we start?
+ */
+ struct GNUNET_TIME_Absolute start_time;
+
+ /**
+ * When do we time out?
+ */
+ struct GNUNET_TIME_Absolute timeout_at;
+
/**
* Obtained status code.
*/
@@ -673,12 +683,34 @@ check_config (struct GNUNET_TIME_Relative timeout,
cr->url))
continue;
if (NULL != cr->co)
+ {
+ struct GNUNET_TIME_Relative duration;
+ struct GNUNET_TIME_Relative left;
+ struct GNUNET_TIME_Relative xleft;
+
+ duration = GNUNET_TIME_absolute_get_duration (cr->start_time);
+ left = GNUNET_TIME_relative_subtract (timeout,
+ duration);
+ xleft = GNUNET_TIME_absolute_get_remaining (cr->timeout_at);
+ if (GNUNET_TIME_relative_cmp (left,
+ <,
+ xleft))
+ {
+ /* new timeout is shorter! */
+ cr->timeout_at = GNUNET_TIME_relative_to_absolute (left);
+ GNUNET_SCHEDULER_cancel (cr->tt);
+ cr->tt = GNUNET_SCHEDULER_add_at (cr->timeout_at,
+ &config_request_timeout,
+ cr);
+ }
return cr; /* already on it */
+ }
break;
}
if (NULL == cr)
{
cr = GNUNET_new (struct ConfigRequest);
+ cr->start_time = GNUNET_TIME_absolute_get ();
cr->url = GNUNET_strdup (url);
GNUNET_CONTAINER_DLL_insert (cr_head,
cr_tail,
@@ -695,9 +727,10 @@ check_config (struct GNUNET_TIME_Relative timeout,
GNUNET_break (0);
return NULL;
}
- cr->tt = GNUNET_SCHEDULER_add_delayed (timeout,
- &config_request_timeout,
- cr);
+ cr->timeout_at = GNUNET_TIME_relative_to_absolute (timeout);
+ cr->tt = GNUNET_SCHEDULER_add_at (cr->timeout_at,
+ &config_request_timeout,
+ cr);
return cr;
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-anastasis] branch master updated: -improve anastasis-gtk with hanging provider: shorten timeout when applicable,
gnunet <=