mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 12:32:37 +00:00
Fix bug #20480: Check the pcb passed to tcp_listen() for the correct state (must be CLOSED).
This commit is contained in:
parent
ebcb46cd48
commit
62c3de30b9
@ -247,6 +247,10 @@ HISTORY
|
|||||||
|
|
||||||
++ Bug fixes:
|
++ Bug fixes:
|
||||||
|
|
||||||
|
2007-07-24 Simon Goldschmidt
|
||||||
|
* api_msg.c, tcp.c: Fix bug #20480: Check the pcb passed to tcp_listen() for the
|
||||||
|
correct state (must be CLOSED).
|
||||||
|
|
||||||
2007-07-13 Thomas Taranowski (commited by Jared Grubb)
|
2007-07-13 Thomas Taranowski (commited by Jared Grubb)
|
||||||
* memp.c: Fix bug #20478: memp_malloc returned NULL+MEMP_SIZE on failed
|
* memp.c: Fix bug #20478: memp_malloc returned NULL+MEMP_SIZE on failed
|
||||||
allocation. It now returns NULL.
|
allocation. It now returns NULL.
|
||||||
|
@ -669,20 +669,24 @@ do_listen(struct api_msg_msg *msg)
|
|||||||
if (msg->conn->err == ERR_OK) {
|
if (msg->conn->err == ERR_OK) {
|
||||||
if (msg->conn->pcb.tcp != NULL) {
|
if (msg->conn->pcb.tcp != NULL) {
|
||||||
if (msg->conn->type == NETCONN_TCP) {
|
if (msg->conn->type == NETCONN_TCP) {
|
||||||
struct tcp_pcb* lpcb = tcp_listen(msg->conn->pcb.tcp);
|
if (msg->conn->pcb.tcp->state == CLOSED) {
|
||||||
if (lpcb == NULL) {
|
struct tcp_pcb* lpcb = tcp_listen(msg->conn->pcb.tcp);
|
||||||
msg->conn->err = ERR_MEM;
|
if (lpcb == NULL) {
|
||||||
} else {
|
msg->conn->err = ERR_MEM;
|
||||||
if (msg->conn->acceptmbox == SYS_MBOX_NULL) {
|
} else {
|
||||||
if ((msg->conn->acceptmbox = sys_mbox_new()) == SYS_MBOX_NULL) {
|
if (msg->conn->acceptmbox == SYS_MBOX_NULL) {
|
||||||
msg->conn->err = ERR_MEM;
|
if ((msg->conn->acceptmbox = sys_mbox_new()) == SYS_MBOX_NULL) {
|
||||||
|
msg->conn->err = ERR_MEM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (msg->conn->err == ERR_OK) {
|
||||||
|
msg->conn->pcb.tcp = lpcb;
|
||||||
|
tcp_arg(msg->conn->pcb.tcp, msg->conn);
|
||||||
|
tcp_accept(msg->conn->pcb.tcp, accept_function);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (msg->conn->err == ERR_OK) {
|
} else {
|
||||||
msg->conn->pcb.tcp = lpcb;
|
msg->conn->err = ERR_CONN;
|
||||||
tcp_arg(msg->conn->pcb.tcp, msg->conn);
|
|
||||||
tcp_accept(msg->conn->pcb.tcp, accept_function);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -343,6 +343,8 @@ tcp_listen(struct tcp_pcb *pcb)
|
|||||||
{
|
{
|
||||||
struct tcp_pcb_listen *lpcb;
|
struct tcp_pcb_listen *lpcb;
|
||||||
|
|
||||||
|
LWIP_ERROR("pcb not already connected", pcb->state == CLOSED, return NULL);
|
||||||
|
|
||||||
/* already listening? */
|
/* already listening? */
|
||||||
if (pcb->state == LISTEN) {
|
if (pcb->state == LISTEN) {
|
||||||
return pcb;
|
return pcb;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user