mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-08-10 01:23:48 +08:00
sockets.h, sockets.c, api.h, api_lib.c, api_msg.h, api_msg.c, tcp.h, tcp_out.c: Integrate "patch #6250 : MSG_MORE flag for send". MSG_MORE is used at socket api layer, NETCONN_MORE at netconn api layer, and TCP_WRITE_FLAG_MORE at raw api layer. This option enable to delayed TCP PUSH flag on multiple "write" calls. Note that previous "copy" parameter for "write" APIs is now called "apiflags".
This commit is contained in:
@@ -546,11 +546,13 @@ netconn_send(struct netconn *conn, struct netbuf *buf)
|
||||
* @param conn the TCP netconn over which to send data
|
||||
* @param dataptr pointer to the application buffer that contains the data to send
|
||||
* @param size size of the application data to send
|
||||
* @param copy flag: 1 = copy the data, 0 = data is non-volatile, can be sent by reference
|
||||
* @param apiflags combination of following flags :
|
||||
* - NETCONN_COPY (0x01) data will be copied into memory belonging to the stack
|
||||
* - NETCONN_MORE (0x02) for TCP connection, PSH flag will be set on last segment sent
|
||||
* @return ERR_OK if data was sent, any other err_t on error
|
||||
*/
|
||||
err_t
|
||||
netconn_write(struct netconn *conn, const void *dataptr, int size, u8_t copy)
|
||||
netconn_write(struct netconn *conn, const void *dataptr, int size, u8_t apiflags)
|
||||
{
|
||||
struct api_msg msg;
|
||||
|
||||
@@ -560,7 +562,7 @@ netconn_write(struct netconn *conn, const void *dataptr, int size, u8_t copy)
|
||||
msg.function = do_write;
|
||||
msg.msg.conn = conn;
|
||||
msg.msg.msg.w.dataptr = dataptr;
|
||||
msg.msg.msg.w.copy = copy;
|
||||
msg.msg.msg.w.apiflags = apiflags;
|
||||
msg.msg.msg.w.len = size;
|
||||
/* For locking the core: this _can_ be delayed on low memory/low send buffer,
|
||||
but if it is, this is done inside api_msg.c:do_write(), so we can use the
|
||||
|
||||
@@ -784,7 +784,7 @@ do_writemore(struct netconn *conn)
|
||||
#endif
|
||||
}
|
||||
|
||||
err = tcp_write(conn->pcb.tcp, dataptr, len, conn->write_msg->msg.w.copy);
|
||||
err = tcp_write(conn->pcb.tcp, dataptr, len, conn->write_msg->msg.w.apiflags);
|
||||
LWIP_ASSERT("do_writemore: invalid length!", ((conn->write_offset + len) <= conn->write_msg->msg.w.len));
|
||||
if (err == ERR_OK) {
|
||||
conn->write_offset += len;
|
||||
|
||||
@@ -538,7 +538,7 @@ lwip_send(int s, const void *data, int size, unsigned int flags)
|
||||
#endif /* (LWIP_UDP || LWIP_RAW) */
|
||||
}
|
||||
|
||||
err = netconn_write(sock->conn, data, size, NETCONN_COPY);
|
||||
err = netconn_write(sock->conn, data, size, NETCONN_COPY | ((flags & MSG_MORE)?NETCONN_MORE:0));
|
||||
|
||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_send(%d) err=%d size=%d\n", s, err, size));
|
||||
sock_set_errno(sock, err_to_errno(err));
|
||||
|
||||
Reference in New Issue
Block a user