Skip to content

Commit 0aa5c5d

Browse files
committed
add size check to write
some more debug output
1 parent 183bc84 commit 0aa5c5d

File tree

1 file changed

+10
-2
lines changed
  • hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/include

1 file changed

+10
-2
lines changed

hardware/esp8266com/esp8266/libraries/ESP8266WiFi/src/include/ClientContext.h

+10-2
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,22 @@ class ClientContext
182182

183183
size_t write(const char* data, size_t size)
184184
{
185-
if (!_pcb)
185+
if (!_pcb) {
186+
DEBUGV(":wr !_pcb\r\n");
186187
return 0;
188+
}
189+
190+
if(size == 0) {
191+
return 0;
192+
}
187193

188194
size_t room = tcp_sndbuf(_pcb);
189195
size_t will_send = (room < size) ? room : size;
190196
err_t err = tcp_write(_pcb, data, will_send, 0);
191-
if (err != ERR_OK)
197+
if (err != ERR_OK) {
198+
DEBUGV(":wr !ERR_OK\r\n");
192199
return 0;
200+
}
193201

194202
_size_sent = will_send;
195203
DEBUGV(":wr\r\n");

0 commit comments

Comments
 (0)