mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-04 02:39:15 +00:00
Minor fixs to reduce footprint on the "recv part" of Sequential API...
This commit is contained in:
parent
c899097802
commit
6bfa99a774
@ -475,6 +475,7 @@ netconn_recv(struct netconn *conn)
|
||||
}
|
||||
|
||||
if (conn->type == NETCONN_TCP) {
|
||||
#if LWIP_TCP
|
||||
if (conn->pcb.tcp->state == LISTEN) {
|
||||
conn->err = ERR_CONN;
|
||||
return NULL;
|
||||
@ -524,7 +525,9 @@ netconn_recv(struct netconn *conn)
|
||||
msg.msg.msg.len = 1;
|
||||
}
|
||||
tcpip_apimsg(&msg);
|
||||
#endif /* LWIP_TCP */
|
||||
} else {
|
||||
#if (LWIP_UDP || LWIP_RAW)
|
||||
#if LWIP_SO_RCVTIMEO
|
||||
sys_mbox_fetch_timeout(conn->recvmbox, (void *)&buf, conn->recv_timeout);
|
||||
#else
|
||||
@ -536,6 +539,7 @@ netconn_recv(struct netconn *conn)
|
||||
if (conn->callback)
|
||||
(*conn->callback)(conn, NETCONN_EVT_RCVMINUS, buf->p->tot_len);
|
||||
}
|
||||
#endif /* (LWIP_UDP || LWIP_RAW) */
|
||||
}
|
||||
|
||||
LWIP_DEBUGF(API_LIB_DEBUG, ("netconn_recv: received %p (err %d)\n", (void *)buf, conn->err));
|
||||
|
@ -437,7 +437,7 @@ lwip_recvfrom(int s, void *mem, int len, unsigned int flags,
|
||||
/* If this is a TCP socket, check if there is data left in the
|
||||
buffer. If so, it should be saved in the sock structure for next
|
||||
time around. */
|
||||
if (netconn_type(sock->conn) == NETCONN_TCP && buflen - copylen > 0) {
|
||||
if ((sock->conn->type == NETCONN_TCP) && (buflen - copylen > 0)) {
|
||||
sock->lastdata = buf;
|
||||
sock->lastoffset += copylen;
|
||||
} else {
|
||||
@ -480,7 +480,7 @@ lwip_send(int s, const void *data, int size, unsigned int flags)
|
||||
#else
|
||||
sock_set_errno(sock, err_to_errno(ERR_ARG));
|
||||
return -1;
|
||||
#endif
|
||||
#endif /* (LWIP_UDP || LWIP_RAW) */
|
||||
|
||||
err = netconn_write( sock->conn, data, size, NETCONN_COPY);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user