summaryrefslogtreecommitdiff
path: root/lib/safe-browsing/ephy-gsb-service.c
diff options
context:
space:
mode:
authorGabriel Ivascu <gabrielivascu@gnome.org>2017-09-22 18:30:50 +0300
committerGabriel Ivascu <gabrielivascu@gnome.org>2017-10-03 18:29:53 +0200
commitdd2d710ccb839ee762187892fb0fe5d9bd8c1b97 (patch)
treef2953d354945e188d39f33275566abc6373fd021 /lib/safe-browsing/ephy-gsb-service.c
parent90db9e188f4b56c60a1367e7a79a2d741e637afd (diff)
downloadepiphany-dd2d710ccb839ee762187892fb0fe5d9bd8c1b97.tar.gz
gsb-service: Make next_full_hashes_time persistent
Diffstat (limited to 'lib/safe-browsing/ephy-gsb-service.c')
-rw-r--r--lib/safe-browsing/ephy-gsb-service.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/safe-browsing/ephy-gsb-service.c b/lib/safe-browsing/ephy-gsb-service.c
index 7417236b1..3eb4a4f8e 100644
--- a/lib/safe-browsing/ephy-gsb-service.c
+++ b/lib/safe-browsing/ephy-gsb-service.c
@@ -414,6 +414,10 @@ ephy_gsb_service_dispose (GObject *object)
ephy_gsb_storage_set_metadata (self->storage,
"next_list_updates_time",
self->next_list_updates_time);
+ /* Store next fullHashes:find request time. */
+ ephy_gsb_storage_set_metadata (self->storage,
+ "next_full_hashes_time",
+ self->next_full_hashes_time);
}
g_clear_object (&self->storage);
@@ -437,6 +441,11 @@ ephy_gsb_service_constructed (GObject *object)
if (!ephy_gsb_storage_is_operable (self->storage))
return;
+ /* Restore next fullHashes:find request time. */
+ self->next_full_hashes_time = ephy_gsb_storage_get_metadata (self->storage,
+ "next_full_hashes_time",
+ CURRENT_TIME);
+
/* Restore next threatListUpdates:fetch request time. */
self->next_list_updates_time = ephy_gsb_storage_get_metadata (self->storage,
"next_list_updates_time",
@@ -609,7 +618,7 @@ ephy_gsb_service_find_full_hashes (EphyGSBService *self,
g_assert (matching_hashes);
g_assert (callback);
- if (CURRENT_TIME < self->next_full_hashes_time) {
+ if (self->next_full_hashes_time > CURRENT_TIME) {
LOG ("Cannot send fullHashes:find request. Requests are restricted for %ld seconds",
self->next_full_hashes_time - CURRENT_TIME);
callback (threats, user_data);