mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-01 04:12:07 +00:00
Fixed bug #35817: do_connect() invalidly signals op_completed for UDP/RAW with LWIP_TCPIP_CORE_LOCKING==1
This commit is contained in:
parent
f8af1a7443
commit
8dbf572ea5
@ -76,6 +76,10 @@ HISTORY
|
|||||||
|
|
||||||
++ Bugfixes:
|
++ Bugfixes:
|
||||||
|
|
||||||
|
2012-03-25: Simon Goldschmidt
|
||||||
|
* api_msg.c: Fixed bug #35817: do_connect() invalidly signals op_completed
|
||||||
|
for UDP/RAW with LWIP_TCPIP_CORE_LOCKING==1
|
||||||
|
|
||||||
2012-03-25: Simon Goldschmidt
|
2012-03-25: Simon Goldschmidt
|
||||||
* api_msg.h, api_lib.c, api_msg.c, netifapi.c: fixed bug #35931: Name space
|
* api_msg.h, api_lib.c, api_msg.c, netifapi.c: fixed bug #35931: Name space
|
||||||
pollution in api_msg.c and netifapi.c
|
pollution in api_msg.c and netifapi.c
|
||||||
|
@ -983,49 +983,58 @@ lwip_netconn_do_connect(struct api_msg_msg *msg)
|
|||||||
if (msg->conn->pcb.tcp == NULL) {
|
if (msg->conn->pcb.tcp == NULL) {
|
||||||
/* This may happen when calling netconn_connect() a second time */
|
/* This may happen when calling netconn_connect() a second time */
|
||||||
msg->err = ERR_CLSD;
|
msg->err = ERR_CLSD;
|
||||||
|
if (NETCONNTYPE_GROUP(msg->conn->type) == NETCONN_TCP) {
|
||||||
|
/* For TCP, netconn_connect() calls tcpip_apimsg(), so signal op_completed here. */
|
||||||
|
sys_sem_signal(&msg->conn->op_completed);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch (NETCONNTYPE_GROUP(msg->conn->type)) {
|
switch (NETCONNTYPE_GROUP(msg->conn->type)) {
|
||||||
#if LWIP_RAW
|
#if LWIP_RAW
|
||||||
case NETCONN_RAW:
|
case NETCONN_RAW:
|
||||||
msg->err = raw_connect(msg->conn->pcb.raw, msg->msg.bc.ipaddr);
|
msg->err = raw_connect(msg->conn->pcb.raw, msg->msg.bc.ipaddr);
|
||||||
break;
|
break;
|
||||||
#endif /* LWIP_RAW */
|
#endif /* LWIP_RAW */
|
||||||
#if LWIP_UDP
|
#if LWIP_UDP
|
||||||
case NETCONN_UDP:
|
case NETCONN_UDP:
|
||||||
msg->err = udp_connect(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port);
|
msg->err = udp_connect(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port);
|
||||||
break;
|
break;
|
||||||
#endif /* LWIP_UDP */
|
#endif /* LWIP_UDP */
|
||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
case NETCONN_TCP:
|
case NETCONN_TCP:
|
||||||
/* Prevent connect while doing any other action. */
|
/* Prevent connect while doing any other action. */
|
||||||
if (msg->conn->state != NETCONN_NONE) {
|
if (msg->conn->state != NETCONN_NONE) {
|
||||||
msg->err = ERR_ISCONN;
|
msg->err = ERR_ISCONN;
|
||||||
} else {
|
} else {
|
||||||
setup_tcp(msg->conn);
|
setup_tcp(msg->conn);
|
||||||
msg->err = tcp_connect(msg->conn->pcb.tcp, msg->msg.bc.ipaddr,
|
msg->err = tcp_connect(msg->conn->pcb.tcp, msg->msg.bc.ipaddr,
|
||||||
msg->msg.bc.port, lwip_netconn_do_connected);
|
msg->msg.bc.port, lwip_netconn_do_connected);
|
||||||
if (msg->err == ERR_OK) {
|
if (msg->err == ERR_OK) {
|
||||||
u8_t non_blocking = netconn_is_nonblocking(msg->conn);
|
u8_t non_blocking = netconn_is_nonblocking(msg->conn);
|
||||||
msg->conn->state = NETCONN_CONNECT;
|
msg->conn->state = NETCONN_CONNECT;
|
||||||
SET_NONBLOCKING_CONNECT(msg->conn, non_blocking);
|
SET_NONBLOCKING_CONNECT(msg->conn, non_blocking);
|
||||||
if (non_blocking) {
|
if (non_blocking) {
|
||||||
msg->err = ERR_INPROGRESS;
|
msg->err = ERR_INPROGRESS;
|
||||||
} else {
|
} else {
|
||||||
msg->conn->current_msg = msg;
|
msg->conn->current_msg = msg;
|
||||||
/* sys_sem_signal() is called from lwip_netconn_do_connected (or err_tcp()),
|
/* sys_sem_signal() is called from lwip_netconn_do_connected (or err_tcp()),
|
||||||
* when the connection is established! */
|
* when the connection is established! */
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
/* For TCP, netconn_connect() calls tcpip_apimsg(), so signal op_completed here. */
|
||||||
break;
|
sys_sem_signal(&msg->conn->op_completed);
|
||||||
|
return;
|
||||||
#endif /* LWIP_TCP */
|
#endif /* LWIP_TCP */
|
||||||
default:
|
default:
|
||||||
LWIP_ERROR("Invalid netconn type", 0, do{ msg->err = ERR_VAL; }while(0));
|
LWIP_ERROR("Invalid netconn type", 0, do{ msg->err = ERR_VAL; }while(0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sys_sem_signal(&msg->conn->op_completed);
|
/* For all other protocols, netconn_connect() calls TCPIP_APIMSG(),
|
||||||
|
so use TCPIP_APIMSG_ACK() here. */
|
||||||
|
TCPIP_APIMSG_ACK(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user