mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-01 04:12:07 +00:00
Fixed bug #28651 (tcp_connect: no callbacks called if tcp_enqueue fails) both in raw- and netconn-API
This commit is contained in:
parent
60696a8485
commit
82318c0ef1
@ -50,6 +50,10 @@ HISTORY
|
||||
|
||||
++ Bugfixes:
|
||||
|
||||
2010-01-21: Simon Goldschmidt
|
||||
* tcp.c, api_msg.c: Fixed bug #28651 (tcp_connect: no callbacks called
|
||||
if tcp_enqueue fails) both in raw- and netconn-API
|
||||
|
||||
2010-01-19: Simon Goldschmidt
|
||||
* api_msg.c: Fixed bug #27316: netconn: Possible deadlock in err_tcp
|
||||
|
||||
|
@ -882,13 +882,18 @@ do_connect(struct api_msg_msg *msg)
|
||||
#endif /* LWIP_UDP */
|
||||
#if LWIP_TCP
|
||||
case NETCONN_TCP:
|
||||
msg->conn->state = NETCONN_CONNECT;
|
||||
msg->conn->current_msg = msg;
|
||||
setup_tcp(msg->conn);
|
||||
msg->err = tcp_connect(msg->conn->pcb.tcp, msg->msg.bc.ipaddr, msg->msg.bc.port,
|
||||
do_connected);
|
||||
/* sys_sem_signal() is called from do_connected (or err_tcp()),
|
||||
* when the connection is established! */
|
||||
if (msg->err == ERR_OK) {
|
||||
msg->conn->state = NETCONN_CONNECT;
|
||||
msg->conn->current_msg = msg;
|
||||
} else {
|
||||
/* tcp_connect failed, so do_connected will not be called: return now */
|
||||
sys_sem_signal(msg->conn->op_completed);
|
||||
}
|
||||
break;
|
||||
#endif /* LWIP_TCP */
|
||||
default:
|
||||
|
@ -550,14 +550,9 @@ tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
|
||||
#endif /* TCP_CALCULATE_EFF_SEND_MSS */
|
||||
pcb->cwnd = 1;
|
||||
pcb->ssthresh = pcb->mss * 10;
|
||||
pcb->state = SYN_SENT;
|
||||
#if LWIP_CALLBACK_API
|
||||
pcb->connected = connected;
|
||||
#endif /* LWIP_CALLBACK_API */
|
||||
TCP_RMV(&tcp_bound_pcbs, pcb);
|
||||
TCP_REG(&tcp_active_pcbs, pcb);
|
||||
|
||||
snmp_inc_tcpactiveopens();
|
||||
|
||||
ret = tcp_enqueue(pcb, NULL, 0, TCP_SYN, 0, TF_SEG_OPTS_MSS
|
||||
#if LWIP_TCP_TIMESTAMPS
|
||||
@ -565,6 +560,12 @@ tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr, u16_t port,
|
||||
#endif
|
||||
);
|
||||
if (ret == ERR_OK) {
|
||||
/* SYN segment was enqueued, changed the pcbs state now */
|
||||
pcb->state = SYN_SENT;
|
||||
TCP_RMV(&tcp_bound_pcbs, pcb);
|
||||
TCP_REG(&tcp_active_pcbs, pcb);
|
||||
snmp_inc_tcpactiveopens();
|
||||
|
||||
tcp_output(pcb);
|
||||
}
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user