picow: depending on memory pressure, may only be able to write 1 MSS
Foamyguy discovered that trying to send >2920 bytes at once consistently failed. I further discovered that sometimes trying to send >1460 bytes would fail too. By "fail", I mean that it would take a very long time (around 200 * 50ms) before erroneously reporting that all bytes were written. In my testing, this change causes larger writes to successfully send either 2920 or 1460 bytes (possibly after doing some 50ms waits for a previous packet to clear). The documentation of socket.send always stated that it COULD send fewer bytes than requested, but adafruit_httpserver assumed that the number of requested bytes were always sent, so after this change alone, adafruit_httpserver will still not work properly. Closes: #7077 (albeit fixes are needed in adafruit_httpserver too)
This commit is contained in:
parent
861b22730e
commit
57756863ef
|
@ -505,8 +505,8 @@ STATIC mp_uint_t lwip_tcp_send(socketpool_socket_obj_t *socket, const byte *buf,
|
|||
break;
|
||||
}
|
||||
if (err == ERR_MEM && write_len > TCP_MSS) {
|
||||
// Try writing just one MSS worth of data
|
||||
write_len = TCP_MSS;
|
||||
// Decreasing the amount sent to the next lower number of MSS
|
||||
write_len = (write_len - 1) / TCP_MSS * TCP_MSS;
|
||||
continue;
|
||||
}
|
||||
err = tcp_output(socket->pcb.tcp);
|
||||
|
|
Loading…
Reference in New Issue