File tree 1 file changed +11
-2
lines changed
libraries/lwIpWrapper/src
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -266,8 +266,7 @@ size_t lwipClient::write(const uint8_t* buffer, size_t size) {
266
266
uint16_t bytes_to_send = 0 ;
267
267
268
268
do {
269
- bytes_to_send = min (size - (buffer - buffer_cursor), tcp_sndbuf (this ->tcp_info ->pcb ));
270
-
269
+ bytes_to_send = min (size - (buffer_cursor - buffer), tcp_sndbuf (this ->tcp_info ->pcb ));
271
270
/*
272
271
* TODO: Look into the following flags, especially for write of 1 byte
273
272
* TCP_WRITE_FLAG_COPY (0x01) data will be copied into memory belonging to the stack
@@ -279,7 +278,17 @@ size_t lwipClient::write(const uint8_t* buffer, size_t size) {
279
278
buffer_cursor += bytes_to_send;
280
279
} else if (res == ERR_MEM) {
281
280
// FIXME handle this: we get into this case only if the sent data cannot be put in the send queue
281
+ CLwipIf::getInstance ().task ();
282
+ // break;
283
+ } else {
284
+ break ;
282
285
}
286
+
287
+ // FIXME blocking call
288
+ while (tcp_sndbuf (this ->tcp_info ->pcb ) == 0 && buffer_cursor - buffer < size) {
289
+ CLwipIf::getInstance ().task ();
290
+ }
291
+
283
292
} while (buffer_cursor - buffer < size);
284
293
285
294
tcp_output (this ->tcp_info ->pcb );
You can’t perform that action at this time.
0 commit comments