File tree 1 file changed +22
-5
lines changed
libraries/ESP8266WiFi/src/include
1 file changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -223,28 +223,45 @@ class ClientContext {
223
223
224
224
size_t room = tcp_sndbuf (_pcb);
225
225
size_t will_send = (room < size) ? room : size;
226
+
227
+ if (_size_sent > 0 ) {
228
+ DEBUGV (" :wr _size_sent: %d\r\n " , _size_sent);
229
+ }
230
+
231
+ _size_sent = will_send;
232
+
226
233
err_t err = tcp_write (_pcb, data, will_send, 0 );
227
234
if (err != ERR_OK) {
228
- DEBUGV (" :wr !ERR_OK\r\n " );
235
+ DEBUGV (" :wr !ERR_OK %d \r\n " , err );
229
236
return 0 ;
230
237
}
231
238
232
- _size_sent = will_send;
233
239
DEBUGV (" :wr\r\n " );
234
240
tcp_output ( _pcb );
241
+ if (err != ERR_OK) {
242
+ DEBUGV (" :wro !ERR_OK %d\r\n " , err);
243
+ return 0 ;
244
+ }
245
+
235
246
_send_waiting = true ;
236
247
delay (5000 ); // max send timeout
237
248
_send_waiting = false ;
238
- DEBUGV (" :ww\r\n " );
249
+
250
+ DEBUGV (" :ww %d\r\n " , (will_send - _size_sent));
239
251
return will_send - _size_sent;
240
252
}
241
253
242
254
private:
243
255
244
256
err_t _sent (tcp_pcb* pcb, uint16_t len) {
245
- DEBUGV (" :sent %d\r\n " , len);
257
+ if (len > _size_sent) {
258
+ DEBUGV (" :sent error len (%d) > _size_sent (%d)!?\r\n " , len, _size_sent);
259
+ }
246
260
_size_sent -= len;
247
- if (_size_sent == 0 && _send_waiting) esp_schedule ();
261
+ DEBUGV (" :sent %d left: %d\r\n " , len, _size_sent);
262
+ if (_size_sent == 0 && _send_waiting) {
263
+ esp_schedule ();
264
+ }
248
265
return ERR_OK;
249
266
}
250
267
You can’t perform that action at this time.
0 commit comments