Skip to content
Snippets Groups Projects
Unverified Commit 892a3735 authored by Peter Kietzmann's avatar Peter Kietzmann Committed by GitHub
Browse files

Merge pull request #10946 from brummer-simon/gnrc_tcp-fix_syn_rcvd_packetloss_deadlock

gnrc_tcp: syn_rcvd pkt loss fix
parents 01cc6536 5dc3f8dc
No related branches found
No related tags found
No related merge requests found
...@@ -203,14 +203,33 @@ static int _gnrc_tcp_open(gnrc_tcp_tcb_t *tcb, char *target_addr, uint16_t targe ...@@ -203,14 +203,33 @@ static int _gnrc_tcp_open(gnrc_tcp_tcb_t *tcb, char *target_addr, uint16_t targe
tcb->state != FSM_STATE_CLOSE_WAIT) { tcb->state != FSM_STATE_CLOSE_WAIT) {
mbox_get(&(tcb->mbox), &msg); mbox_get(&(tcb->mbox), &msg);
switch (msg.type) { switch (msg.type) {
case MSG_TYPE_NOTIFY_USER:
DEBUG("gnrc_tcp.c : _gnrc_tcp_open() : MSG_TYPE_NOTIFY_USER\n");
/* Setup a timeout to be able to revert back to LISTEN state, in case the
* send SYN+ACK we received upon entering SYN_RCVD is never acknowledged
* by the peer. */
if ((tcb->state == FSM_STATE_SYN_RCVD) && (tcb->status & STATUS_PASSIVE)) {
_setup_timeout(&connection_timeout, GNRC_TCP_CONNECTION_TIMEOUT_DURATION,
_cb_mbox_put_msg, &connection_timeout_arg);
}
break;
case MSG_TYPE_CONNECTION_TIMEOUT: case MSG_TYPE_CONNECTION_TIMEOUT:
DEBUG("gnrc_tcp.c : _gnrc_tcp_open() : CONNECTION_TIMEOUT\n"); DEBUG("gnrc_tcp.c : _gnrc_tcp_open() : CONNECTION_TIMEOUT\n");
_fsm(tcb, FSM_EVENT_TIMEOUT_CONNECTION, NULL, NULL, 0);
ret = -ETIMEDOUT;
break;
case MSG_TYPE_NOTIFY_USER: /* The connection establishment attempt timed out:
DEBUG("gnrc_tcp.c : _gnrc_tcp_open() : MSG_TYPE_NOTIFY_USER\n"); * 1) Active connections return -ETIMEOUT.
* 2) Passive connections stop the ongoing retransmissions and repeat the
* open call to wait for the next connection attempt. */
if (tcb->status & STATUS_PASSIVE) {
_fsm(tcb, FSM_EVENT_CLEAR_RETRANSMIT, NULL, NULL, 0);
_fsm(tcb, FSM_EVENT_CALL_OPEN, NULL, NULL, 0);
}
else {
_fsm(tcb, FSM_EVENT_TIMEOUT_CONNECTION, NULL, NULL, 0);
ret = -ETIMEDOUT;
}
break; break;
default: default:
......
...@@ -191,6 +191,7 @@ static int _transition_to(gnrc_tcp_tcb_t *tcb, fsm_state_t state) ...@@ -191,6 +191,7 @@ static int _transition_to(gnrc_tcp_tcb_t *tcb, fsm_state_t state)
mutex_unlock(&_list_tcb_lock); mutex_unlock(&_list_tcb_lock);
break; break;
case FSM_STATE_SYN_RCVD:
case FSM_STATE_ESTABLISHED: case FSM_STATE_ESTABLISHED:
case FSM_STATE_CLOSE_WAIT: case FSM_STATE_CLOSE_WAIT:
tcb->status |= STATUS_NOTIFY_USER; tcb->status |= STATUS_NOTIFY_USER;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment