|
1 | 1 | /*
|
2 | 2 | ClientContext.h - TCP connection handling on top of lwIP
|
3 |
| -
|
4 | 3 | Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
|
5 | 4 | This file is part of the esp8266 core for Arduino environment.
|
6 |
| -
|
7 | 5 | This library is free software; you can redistribute it and/or
|
8 | 6 | modify it under the terms of the GNU Lesser General Public
|
9 | 7 | License as published by the Free Software Foundation; either
|
10 | 8 | version 2.1 of the License, or (at your option) any later version.
|
11 |
| -
|
12 | 9 | This library is distributed in the hope that it will be useful,
|
13 | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15 | 12 | Lesser General Public License for more details.
|
16 |
| -
|
17 | 13 | You should have received a copy of the GNU Lesser General Public
|
18 | 14 | License along with this library; if not, write to the Free Software
|
19 | 15 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
@@ -130,11 +126,8 @@ class ClientContext
|
130 | 126 | }
|
131 | 127 | _connect_pending = 1;
|
132 | 128 | _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); |
138 | 131 | _connect_pending = 0;
|
139 | 132 | if (!_pcb) {
|
140 | 133 | DEBUGV(":cabrt\r\n");
|
@@ -459,11 +452,8 @@ class ClientContext
|
459 | 452 | }
|
460 | 453 |
|
461 | 454 | _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); |
467 | 457 | } while(true);
|
468 | 458 | _send_waiting = false;
|
469 | 459 |
|
@@ -609,7 +599,6 @@ class ClientContext
|
609 | 599 | (void) pcb;
|
610 | 600 | assert(pcb == _pcb);
|
611 | 601 | assert(_connect_pending);
|
612 |
| - _connect_pending = 0; |
613 | 602 | esp_schedule();
|
614 | 603 | return ERR_OK;
|
615 | 604 | }
|
|
0 commit comments