Skip to content

Commit 28df8dc

Browse files
committed
Fix issue on write error
1 parent 970dd04 commit 28df8dc

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

WiFi/WiFiClient.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,17 @@ size_t WiFiClient::write(const uint8_t *buf, size_t size) {
7070
}
7171

7272

73-
if ((!ServerDrv::sendData(_sock, buf, size)) ||
74-
(!ServerDrv::checkDataSent(_sock)))
73+
if (!ServerDrv::sendData(_sock, buf, size))
7574
{
7675
setWriteError();
7776
return 0;
7877
}
78+
if (!ServerDrv::checkDataSent(_sock))
79+
{
80+
setWriteError();
81+
return 0;
82+
}
83+
7984
return size;
8085
}
8186

WiFi/utility/server_drv.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ bool ServerDrv::sendData(uint8_t sock, const uint8_t *data, uint16_t len)
226226

227227
uint8_t ServerDrv::checkDataSent(uint8_t sock)
228228
{
229-
const uint16_t TIMEOUT_DATA_SENT = 250;
230-
static uint16_t timeout = 0;
229+
const uint16_t TIMEOUT_DATA_SENT = 25;
230+
uint16_t timeout = 0;
231231
uint8_t _data = 0;
232232
uint8_t _dataLen = 0;
233233

@@ -250,7 +250,7 @@ uint8_t ServerDrv::checkDataSent(uint8_t sock)
250250
if (_data) timeout = 0;
251251
else{
252252
++timeout;
253-
delay(10);
253+
delay(100);
254254
}
255255

256256
}while((_data==0)&&(timeout<TIMEOUT_DATA_SENT));

0 commit comments

Comments
 (0)