From f59193b625a367331648a6a197528227af49f885 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 5 Mar 2020 20:51:02 +0100 Subject: [PATCH] fixed bug in SQL access where timeout was compared to a negative value --- libretroshare/src/util/retrodb.cc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libretroshare/src/util/retrodb.cc b/libretroshare/src/util/retrodb.cc index a539c1676..122f3e6a1 100644 --- a/libretroshare/src/util/retrodb.cc +++ b/libretroshare/src/util/retrodb.cc @@ -185,7 +185,7 @@ bool RetroDb::execSQL(const std::string &query){ uint32_t delta = 3; - rstime_t stamp = time(NULL), now = 0; + rstime_t stamp = time(NULL); bool timeOut = false, ok = false; while(!timeOut){ @@ -202,10 +202,8 @@ bool RetroDb::execSQL(const std::string &query){ break; } - now = time(NULL); - delta = stamp - now; - - if(delta > TIME_LIMIT){ + if(time(NULL) > stamp + TIME_LIMIT) + { ok = false; timeOut = true; }