mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-26 18:17:10 +08:00
Move write_offset from struct netconn to struct api_msg
This moves the write_offset variable from struct netconn to struct api_msg This optimizes the storage by only having the space claimed when it is needed (during a netconn_write_partly() call) and not throughout the lifetime of the netconn This also reduces code space/execution by not having to separately manage clearing/checking write_offset from the current_msg pointer Lastly, we also save execution by using msg.w.offset as the output rather than marshaling the result to msg.w.len. Previously, len was used as input length of dataptr and output for the write operation. netconn_write_partly() also has access to msg.w.offset, so we can use that
This commit is contained in:
@@ -258,9 +258,6 @@ struct netconn {
|
||||
/** flags holding more netconn-internal state, see NETCONN_FLAG_* defines */
|
||||
u8_t flags;
|
||||
#if LWIP_TCP
|
||||
/** TCP: when data passed to netconn_write doesn't fit into the send buffer,
|
||||
this temporarily stores how much is already sent. */
|
||||
size_t write_offset;
|
||||
/** TCP: when data passed to netconn_write doesn't fit into the send buffer,
|
||||
this temporarily stores the message.
|
||||
Also used during connect and close. */
|
||||
|
||||
@@ -104,7 +104,10 @@ struct api_msg {
|
||||
/** used for lwip_netconn_do_write */
|
||||
struct {
|
||||
const void *dataptr;
|
||||
/** total length of dataptr */
|
||||
size_t len;
|
||||
/** offset into dataptr/output of bytes written */
|
||||
size_t offset;
|
||||
u8_t apiflags;
|
||||
#if LWIP_SO_SNDTIMEO
|
||||
u32_t time_started;
|
||||
|
||||
Reference in New Issue
Block a user