Skip to content

Commit 25c95ac

Browse files
sislakdd-a-v
authored andcommitted
Bugfix for stuck in write method of WiFiClient and WiFiClientSecure until the remote peer closed connection (#6104)
* Bugfix - write method of WiFiClient and WiFiClientSecure can stuck forever * Adjustment of uint8_t to bool to have it clear flag
1 parent 2dff28a commit 25c95ac

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

libraries/ESP8266WiFi/src/include/ClientContext.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ class ClientContext
437437
size_t _write_from_source(DataSource* ds)
438438
{
439439
assert(_datasource == nullptr);
440-
assert(_send_waiting == 0);
440+
assert(!_send_waiting);
441441
_datasource = ds;
442442
_written = 0;
443443
_op_start_time = millis();
@@ -455,10 +455,10 @@ class ClientContext
455455
break;
456456
}
457457

458-
++_send_waiting;
458+
_send_waiting = true;
459459
esp_yield();
460460
} while(true);
461-
_send_waiting = 0;
461+
_send_waiting = false;
462462

463463
if (_sync)
464464
wait_until_sent();
@@ -525,8 +525,8 @@ class ClientContext
525525

526526
void _write_some_from_cb()
527527
{
528-
if (_send_waiting == 1) {
529-
_send_waiting--;
528+
if (_send_waiting) {
529+
_send_waiting = false;
530530
esp_schedule();
531531
}
532532
}
@@ -650,7 +650,7 @@ class ClientContext
650650
size_t _written = 0;
651651
uint32_t _timeout_ms = 5000;
652652
uint32_t _op_start_time = 0;
653-
uint8_t _send_waiting = 0;
653+
bool _send_waiting = false;
654654
uint8_t _connect_pending = 0;
655655

656656
int8_t _refcnt;

0 commit comments

Comments
 (0)