Skip to content

Commit 6da2bfb

Browse files
authored
simplifying internal code using stream::send api (#7995)
1 parent 4462fea commit 6da2bfb

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp

+1-17
Original file line numberDiff line numberDiff line change
@@ -333,28 +333,12 @@ size_t WiFiClientSecureCtx::write_P(PGM_P buf, size_t size) {
333333
return _write((const uint8_t *)buf, size, true);
334334
}
335335

336-
// We have to manually read and send individual chunks.
337336
size_t WiFiClientSecureCtx::write(Stream& stream) {
338-
size_t totalSent = 0;
339-
size_t countRead;
340-
size_t countSent;
341-
342337
if (!connected() || !_handshake_done) {
343338
DEBUG_BSSL("write: Connect/handshake not completed yet\n");
344339
return 0;
345340
}
346-
347-
do {
348-
uint8_t temp[256]; // Temporary chunk size same as ClientContext
349-
countSent = 0;
350-
countRead = stream.readBytes(temp, sizeof(temp));
351-
if (countRead) {
352-
countSent = _write((const uint8_t*)temp, countRead, true);
353-
totalSent += countSent;
354-
}
355-
yield(); // Feed the WDT
356-
} while ((countSent == countRead) && (countSent > 0));
357-
return totalSent;
341+
return stream.sendAll(this);
358342
}
359343

360344
int WiFiClientSecureCtx::read(uint8_t *buf, size_t size) {

0 commit comments

Comments
 (0)