Index: api_lib.c =================================================================== RCS file: /sources/lwip/lwip/src/api/api_lib.c,v retrieving revision 1.22 diff -u -r1.22 api_lib.c --- api_lib.c 26 May 2006 07:39:39 -0000 1.22 +++ api_lib.c 12 Jun 2006 12:05:59 -0000 @@ -422,12 +422,14 @@ if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) { return ERR_MEM; } + conn->state = NETCONN_CONNECT; msg->type = API_MSG_CONNECT; msg->msg.conn = conn; msg->msg.msg.bc.ipaddr = addr; msg->msg.msg.bc.port = port; api_msg_post(msg); sys_mbox_fetch(conn->mbox, NULL); + conn->state = NETCONN_NONE; memp_free(MEMP_API_MSG, msg); return conn->err; } Index: api_msg.c =================================================================== RCS file: /sources/lwip/lwip/src/api/api_msg.c,v retrieving revision 1.19 diff -u -r1.19 api_msg.c --- api_msg.c 21 Jul 2004 08:55:26 -0000 1.19 +++ api_msg.c 12 Jun 2006 12:07:10 -0000 @@ -183,7 +183,7 @@ (*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) { sys_mbox_post(conn->mbox, NULL); } if (conn->acceptmbox != SYS_MBOX_NULL) {