Correctly set TCP_WRITE_FLAG_MORE when netconn_write is split into multiple calls to tcp_write.

This commit is contained in:
goldsimon 2010-03-05 11:34:43 +00:00
parent b6542b977e
commit 0b5d60db5e
2 changed files with 8 additions and 1 deletions

View File

@ -141,6 +141,10 @@ HISTORY
++ Bugfixes:
2010-03-05: Simon Goldschmidt
* api_msg.c: Correctly set TCP_WRITE_FLAG_MORE when netconn_write is split
into multiple calls to tcp_write.
2010-02-21: Simon Goldschmidt
* opt.h, mem.h, dns.c: task #10140: Remove DNS_USES_STATIC_BUF (keep
the implementation of DNS_USES_STATIC_BUF==1)

View File

@ -1142,6 +1142,7 @@ do_writemore(struct netconn *conn)
size_t diff;
u8_t dontblock = netconn_is_nonblocking(conn) ||
(conn->current_msg->msg.w.apiflags & NETCONN_DONTBLOCK);
u8_t apiflags = conn->current_msg->msg.w.apiflags;
LWIP_ASSERT("conn != NULL", conn != NULL);
LWIP_ASSERT("conn->state == NETCONN_WRITE", (conn->state == NETCONN_WRITE));
@ -1157,6 +1158,7 @@ do_writemore(struct netconn *conn)
#if LWIP_TCPIP_CORE_LOCKING
conn->flags |= NETCONN_FLAG_WRITE_DELAYED;
#endif
apiflags |= TCP_WRITE_FLAG_MORE;
} else {
len = (u16_t)diff;
}
@ -1167,6 +1169,7 @@ do_writemore(struct netconn *conn)
#if LWIP_TCPIP_CORE_LOCKING
conn->flags |= NETCONN_FLAG_WRITE_DELAYED;
#endif
apiflags |= TCP_WRITE_FLAG_MORE;
}
if (dontblock && (len < conn->current_msg->msg.w.len)) {
/* failed to send all data at once -> nonblocking write not possible */
@ -1174,7 +1177,7 @@ do_writemore(struct netconn *conn)
}
if (err == ERR_OK) {
LWIP_ASSERT("do_writemore: invalid length!", ((conn->write_offset + len) <= conn->current_msg->msg.w.len));
err = tcp_write(conn->pcb.tcp, dataptr, len, conn->current_msg->msg.w.apiflags);
err = tcp_write(conn->pcb.tcp, dataptr, len, apiflags);
}
if (dontblock && (err == ERR_MEM)) {
/* nonblocking write failed */