Skip to content

Commit

Permalink
Making timeout configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
witnessmenow committed Mar 21, 2018
1 parent 89beefd commit a12c462
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/UniversalTelegramBot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ String UniversalTelegramBot::sendGetToTelegram(String command) {
client->println("GET /"+command);
now=millis();
avail=false;
while (millis() - now < longPoll * 1000 + 1500) {
while (millis() - now < longPoll * 1000 + waitForResponse) {
while (client->available()) {
char c = client->read();
//Serial.write(c);
Expand Down Expand Up @@ -125,7 +125,7 @@ String UniversalTelegramBot::sendPostToTelegram(String command, JsonObject& payl
responseReceived=false;
bool finishedHeaders = false;
bool currentLineIsBlank = true;
while (millis()-now<1500) {
while (millis() - now < waitForResponse) {
while (client->available()) {
char c = client->read();
responseReceived=true;
Expand Down Expand Up @@ -255,7 +255,7 @@ String UniversalTelegramBot::sendMultipartFormDataToTelegram(String command, Str
now=millis();
bool finishedHeaders = false;
bool currentLineIsBlank = true;
while (millis()-now<1500) {
while (millis() - now < waitForResponse) {
while (client->available()) {
char c = client->read();
responseReceived=true;
Expand Down
1 change: 1 addition & 0 deletions src/UniversalTelegramBot.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class UniversalTelegramBot
String userName;
int longPoll = 0;
bool _debug = false;
int waitForResponse = 1500;

private:
//JsonObject * parseUpdates(String response);
Expand Down

0 comments on commit a12c462

Please sign in to comment.