Skip to content

Commit a0c975d

Browse files
dyarkovoyme-no-dev
authored andcommitted
Reset retry counter upon successful write (#2638)
Currently WiFiClient::write is unable to send messages over 25Kb, because of the hard-coded retry limit of 10, that is getting decremented on every successful send. Since we cannot send more than 2*MTU bytes in one go, and have only 10 retries, write() is limited to approximately 25Kb. Technically it is not a bug, as it correctly returns the number of sent bytes and the caller can set up futher retries. But not all libs are aware of this behavior, for example, WebServer is not. I suggest improving current behavior by resetting retry counter every time we had a successful write, so the limit of 10 retries will apply to Failed writes only, and will not apply to Successful writes. This will allow to write() blobs of arbitrary sizes.
1 parent 0906bf5 commit a0c975d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: libraries/WiFi/src/WiFiClient.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ size_t WiFiClient::write(const uint8_t *buf, size_t size)
358358
} else {
359359
buf += res;
360360
bytesRemaining -= res;
361+
retry = WIFI_CLIENT_MAX_WRITE_RETRY;
361362
}
362363
}
363364
else if(res < 0) {

0 commit comments

Comments
 (0)