Skip to content

Commit a94442e

Browse files
authored
Merge pull request esp8266#6 from ascillato/patch-2
Patch 2
2 parents 093471f + 6481dce commit a94442e

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

libraries/ESP8266WiFi/src/include/ClientContext.h

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
11
/*
22
ClientContext.h - TCP connection handling on top of lwIP
3-
43
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
54
This file is part of the esp8266 core for Arduino environment.
6-
75
This library is free software; you can redistribute it and/or
86
modify it under the terms of the GNU Lesser General Public
97
License as published by the Free Software Foundation; either
108
version 2.1 of the License, or (at your option) any later version.
11-
129
This library is distributed in the hope that it will be useful,
1310
but WITHOUT ANY WARRANTY; without even the implied warranty of
1411
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1512
Lesser General Public License for more details.
16-
1713
You should have received a copy of the GNU Lesser General Public
1814
License along with this library; if not, write to the Free Software
1915
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
@@ -130,11 +126,8 @@ class ClientContext
130126
}
131127
_connect_pending = 1;
132128
_op_start_time = millis();
133-
// Following delay will be interrupted by connect callback
134-
for (decltype(_timeout_ms) i = 0; _connect_pending && i < _timeout_ms; i++) {
135-
// Give scheduled functions a chance to run (e.g. Ethernet uses recurrent)
136-
delay(1);
137-
}
129+
// This delay will be interrupted by esp_schedule in the connect callback
130+
delay(_timeout_ms);
138131
_connect_pending = 0;
139132
if (!_pcb) {
140133
DEBUGV(":cabrt\r\n");
@@ -459,11 +452,8 @@ class ClientContext
459452
}
460453

461454
_send_waiting = true;
462-
// Following delay will be interrupted by on next received ack
463-
for (decltype(_timeout_ms) i = 0; _send_waiting && i < _timeout_ms; i++) {
464-
// Give scheduled functions a chance to run (e.g. Ethernet uses recurrent)
465-
delay(1);
466-
}
455+
// This delay will be interrupted by esp_schedule on next received ack
456+
delay(_timeout_ms);
467457
} while(true);
468458
_send_waiting = false;
469459

@@ -609,7 +599,6 @@ class ClientContext
609599
(void) pcb;
610600
assert(pcb == _pcb);
611601
assert(_connect_pending);
612-
_connect_pending = 0;
613602
esp_schedule();
614603
return ERR_OK;
615604
}

0 commit comments

Comments
 (0)