summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorVictor Toso <me@victortoso.com>2016-07-30 18:22:51 +0200
committerVictor Toso <me@victortoso.com>2016-09-05 14:31:43 +0200
commitb4dca1129989f9d9fc4a274860d38566802cd11c (patch)
tree57ef0637f26f861c9a24ab1b23b63796ed5b6383 /libs
parent75448d86a70cf5ffbe7be5b3a930749dbffb15b0 (diff)
downloadgrilo-b4dca1129989f9d9fc4a274860d38566802cd11c.tar.gz
net: Initialize GTimeVal for throttling
The last_request variable was never initialized leading to delay between request to not work. https://bugzilla.gnome.org/show_bug.cgi?id=769331
Diffstat (limited to 'libs')
-rw-r--r--libs/net/grl-net-wc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libs/net/grl-net-wc.c b/libs/net/grl-net-wc.c
index ed3f0ba..8ed4dc2 100644
--- a/libs/net/grl-net-wc.c
+++ b/libs/net/grl-net-wc.c
@@ -762,12 +762,14 @@ get_url (GrlNetWc *self,
if ((now.tv_sec - priv->last_request.tv_sec) > priv->throttling
|| is_mocked()) {
+ priv->last_request = now;
id = g_idle_add_full (G_PRIORITY_HIGH_IDLE,
get_url_cb, c, request_clos_destroy);
} else {
- GRL_DEBUG ("delaying web request");
-
priv->last_request.tv_sec += priv->throttling;
+
+ GRL_DEBUG ("delaying web request by %lu seconds",
+ priv->last_request.tv_sec - now.tv_sec);
id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT,
priv->last_request.tv_sec - now.tv_sec,
get_url_cb, c, request_clos_destroy);