BastliBridge

A bot framework bridgin multiple IM protocols, and mail
git clone git://xatko.vsos.ethz.ch/BastliBridge.git
Log | Files | Refs | Submodules

commit 8e6c3d2ed4aac383ef54d4e981b47f946d664c7f
parent a8aa3167eb58157f95d26bbfa47f34d5d5e35e6d
Author: Dominik Schmidt <das1993@hotmail.com>
Date:   Wed, 22 Nov 2017 22:09:39 +0100

Prevent multiple calls to triggerUpdates in telegram.d

Diffstat:
src/bastlibridge/telegram.d | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/bastlibridge/telegram.d b/src/bastlibridge/telegram.d @@ -235,7 +235,14 @@ struct Telegram{ } } + bool updateRunning=false; + void triggerUpdates(uint timeout=600){ + if(updateRunning){ + warning("Update called in a row without a reply"); + return; + } + updateRunning=true; trace("Triggering Update with timeout ", timeout); string params=format!"offset=%d&timeout=%d"(lastUpdate+1,timeout); post("getUpdates",params); @@ -244,6 +251,7 @@ struct Telegram{ void delegate(JSONValue jv)[] onMessage; bool read(){ + updateRunning=false; auto updates=response(); if(updates.isNull){ triggerUpdates();