api_msg.c: Fix bug #16830: "err_tcp() posts to connection mailbox when no pend on the mailbox is active". Now, the post is only done during a connect, and do_send, do_write and do_join_leave_group don't do anything if a previous error was signaled.

This commit is contained in:
fbernon 2007-04-05 16:54:20 +00:00
parent 7fdd312cca
commit 5f1aac1450
2 changed files with 82 additions and 69 deletions

View File

@ -106,6 +106,11 @@ HISTORY
++ Bug fixes:
2007-04-05 Frédéric Bernon, Jonathan Larmour
* api_msg.c: Fix bug #16830: "err_tcp() posts to connection mailbox when no pend on
the mailbox is active". Now, the post is only done during a connect, and do_send,
do_write and do_join_leave_group don't do anything if a previous error was signaled.
2007-04-03 Frédéric Bernon
* ip.c: Don't set the IP_DF ("Don't fragment") flag in the IP header in IP output
packets. See patch #5834.

View File

@ -196,7 +196,8 @@ err_tcp(void *arg, err_t err)
(*conn->callback)(conn, NETCONN_EVT_RCVPLUS, 0);
sys_mbox_post(conn->recvmbox, NULL);
}
if (conn->mbox != SYS_MBOX_NULL) {
if (conn->mbox != SYS_MBOX_NULL && conn->state == NETCONN_CONNECT) {
conn->state = NETCONN_NONE;
sys_mbox_post(conn->mbox, NULL);
}
if (conn->acceptmbox != SYS_MBOX_NULL) {
@ -458,6 +459,7 @@ do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
if (conn->type == NETCONN_TCP && err == ERR_OK) {
setup_tcp(conn);
}
conn->state = NETCONN_NONE;
sys_mbox_post(conn->mbox, NULL);
return ERR_OK;
}
@ -492,11 +494,10 @@ do_connect(struct api_msg_msg *msg)
#endif /* LWIP_UDP */
#if LWIP_TCP
case NETCONN_TCP:
/*tcp_arg(msg->conn->pcb.tcp, msg->conn);*/
msg->conn->state = NETCONN_CONNECT;
setup_tcp(msg->conn);
tcp_connect(msg->conn->pcb.tcp, msg->msg.bc.ipaddr, msg->msg.bc.port,
do_connected);
/*tcp_output(msg->conn->pcb.tcp);*/
#endif /* LWIP_TCP */
default:
@ -574,6 +575,8 @@ do_listen(struct api_msg_msg *msg)
static void
do_send(struct api_msg_msg *msg)
{
if (msg->conn->err!=ERR_OK) {
if (msg->conn->pcb.tcp != NULL) {
switch (msg->conn->type) {
#if LWIP_RAW
@ -594,6 +597,7 @@ do_send(struct api_msg_msg *msg)
break;
}
}
}
sys_mbox_post(msg->conn->mbox, NULL);
}
@ -616,6 +620,7 @@ do_write(struct api_msg_msg *msg)
#if LWIP_TCP
err_t err;
#endif
if (msg->conn->err!=ERR_OK) {
if (msg->conn->pcb.tcp != NULL) {
switch (msg->conn->type) {
#if LWIP_RAW
@ -656,6 +661,7 @@ do_write(struct api_msg_msg *msg)
break;
}
}
}
sys_mbox_post(msg->conn->mbox, NULL);
}
@ -702,6 +708,7 @@ do_join_leave_group(struct api_msg_msg *msg)
{
err_t err = ERR_OK;
if (msg->conn->err!=ERR_OK) {
if (msg->conn->pcb.tcp != NULL) {
switch (msg->conn->type) {
#if LWIP_RAW
@ -727,6 +734,7 @@ do_join_leave_group(struct api_msg_msg *msg)
}
}
msg->conn->err = err;
}
sys_mbox_post(msg->conn->mbox, NULL);
}
#endif /* LWIP_IGMP */