mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +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 (conn->type == NETCONN_TCP) {
|
||||||
|
#if LWIP_TCP
|
||||||
if (conn->pcb.tcp->state == LISTEN) {
|
if (conn->pcb.tcp->state == LISTEN) {
|
||||||
conn->err = ERR_CONN;
|
conn->err = ERR_CONN;
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -524,7 +525,9 @@ netconn_recv(struct netconn *conn)
|
|||||||
msg.msg.msg.len = 1;
|
msg.msg.msg.len = 1;
|
||||||
}
|
}
|
||||||
tcpip_apimsg(&msg);
|
tcpip_apimsg(&msg);
|
||||||
|
#endif /* LWIP_TCP */
|
||||||
} else {
|
} else {
|
||||||
|
#if (LWIP_UDP || LWIP_RAW)
|
||||||
#if LWIP_SO_RCVTIMEO
|
#if LWIP_SO_RCVTIMEO
|
||||||
sys_mbox_fetch_timeout(conn->recvmbox, (void *)&buf, conn->recv_timeout);
|
sys_mbox_fetch_timeout(conn->recvmbox, (void *)&buf, conn->recv_timeout);
|
||||||
#else
|
#else
|
||||||
@ -536,6 +539,7 @@ netconn_recv(struct netconn *conn)
|
|||||||
if (conn->callback)
|
if (conn->callback)
|
||||||
(*conn->callback)(conn, NETCONN_EVT_RCVMINUS, buf->p->tot_len);
|
(*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));
|
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
|
/* 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
|
buffer. If so, it should be saved in the sock structure for next
|
||||||
time around. */
|
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->lastdata = buf;
|
||||||
sock->lastoffset += copylen;
|
sock->lastoffset += copylen;
|
||||||
} else {
|
} else {
|
||||||
@ -480,7 +480,7 @@ lwip_send(int s, const void *data, int size, unsigned int flags)
|
|||||||
#else
|
#else
|
||||||
sock_set_errno(sock, err_to_errno(ERR_ARG));
|
sock_set_errno(sock, err_to_errno(ERR_ARG));
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif /* (LWIP_UDP || LWIP_RAW) */
|
||||||
|
|
||||||
err = netconn_write( sock->conn, data, size, NETCONN_COPY);
|
err = netconn_write( sock->conn, data, size, NETCONN_COPY);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user