mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
lwip_netconn_do_writemore() cleanups
This commit makes a couple of cleanups discussed in patch #8882: 1) msg.w.offset should not be set to 0 in the error case. It is only valid when err == ERR_OK 2) Remove out-of-date comment which indicated the entire write had completed (not true for non-blocking write) This also updates the documentation on offset to include that offset is only valid when err == ERR_OK
This commit is contained in:
parent
0da9cf70ea
commit
36fa1a97d4
@ -1564,7 +1564,6 @@ err_mem:
|
||||
conn->current_msg->msg.w.offset += len;
|
||||
if ((conn->current_msg->msg.w.offset == conn->current_msg->msg.w.len) || dontblock) {
|
||||
/* return sent length (caller reads length from msg.w.offset) */
|
||||
/* everything was written */
|
||||
write_finished = 1;
|
||||
}
|
||||
out_err = tcp_output(conn->pcb.tcp);
|
||||
@ -1574,7 +1573,6 @@ err_mem:
|
||||
to the application thread. */
|
||||
err = out_err;
|
||||
write_finished = 1;
|
||||
conn->current_msg->msg.w.offset = 0;
|
||||
}
|
||||
} else if (err == ERR_MEM) {
|
||||
/* If ERR_MEM, we wait for sent_tcp or poll_tcp to be called.
|
||||
@ -1590,18 +1588,15 @@ err_mem:
|
||||
to the application thread. */
|
||||
err = out_err;
|
||||
write_finished = 1;
|
||||
conn->current_msg->msg.w.offset = 0;
|
||||
} else if (dontblock) {
|
||||
/* non-blocking write is done on ERR_MEM */
|
||||
err = ERR_WOULDBLOCK;
|
||||
write_finished = 1;
|
||||
conn->current_msg->msg.w.offset = 0;
|
||||
}
|
||||
} else {
|
||||
/* On errors != ERR_MEM, we don't try writing any more but return
|
||||
the error to the application thread. */
|
||||
write_finished = 1;
|
||||
conn->current_msg->msg.w.offset = 0;
|
||||
}
|
||||
}
|
||||
if (write_finished) {
|
||||
|
@ -106,7 +106,7 @@ struct api_msg {
|
||||
const void *dataptr;
|
||||
/** total length of dataptr */
|
||||
size_t len;
|
||||
/** offset into dataptr/output of bytes written */
|
||||
/** offset into dataptr/output of bytes written when err == ERR_OK */
|
||||
size_t offset;
|
||||
u8_t apiflags;
|
||||
#if LWIP_SO_SNDTIMEO
|
||||
|
Loading…
Reference in New Issue
Block a user