mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:56:26 +00:00
[LWIP]
- Call tcp_shutdown() two different times for TX|RX shutdown to avoid the tcp_close() problem entirely - Forcefully close the socket in LibTCPCloseCallback (not optimal, but good enough) svn path=/trunk/; revision=58896
This commit is contained in:
parent
a0d79bf7b9
commit
93ce06d95e
1 changed files with 11 additions and 8 deletions
|
@ -631,7 +631,14 @@ LibTCPShutdownCallback(void *arg)
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg->Output.Shutdown.Error = tcp_shutdown(pcb, msg->Input.Shutdown.shut_rx, msg->Input.Shutdown.shut_tx);
|
/* These need to be called separately, otherwise we get a tcp_close() */
|
||||||
|
if (msg->Input.Shutdown.shut_rx) {
|
||||||
|
msg->Output.Shutdown.Error = tcp_shutdown(pcb, TRUE, FALSE);
|
||||||
|
}
|
||||||
|
if (msg->Input.Shutdown.shut_tx) {
|
||||||
|
msg->Output.Shutdown.Error = tcp_shutdown(pcb, FALSE, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
if (!msg->Output.Shutdown.Error)
|
if (!msg->Output.Shutdown.Error)
|
||||||
{
|
{
|
||||||
if (msg->Input.Shutdown.shut_rx)
|
if (msg->Input.Shutdown.shut_rx)
|
||||||
|
@ -642,10 +649,6 @@ LibTCPShutdownCallback(void *arg)
|
||||||
|
|
||||||
if (msg->Input.Shutdown.shut_tx)
|
if (msg->Input.Shutdown.shut_tx)
|
||||||
msg->Input.Shutdown.Connection->SendShutdown = TRUE;
|
msg->Input.Shutdown.Connection->SendShutdown = TRUE;
|
||||||
|
|
||||||
/* Shutting down both sides is like a close to LwIP, so clear the context */
|
|
||||||
if (msg->Input.Shutdown.shut_rx && msg->Input.Shutdown.shut_tx)
|
|
||||||
msg->Input.Shutdown.Connection->SocketContext = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -706,7 +709,6 @@ LibTCPCloseCallback(void *arg)
|
||||||
case CLOSED:
|
case CLOSED:
|
||||||
case LISTEN:
|
case LISTEN:
|
||||||
case SYN_SENT:
|
case SYN_SENT:
|
||||||
case CLOSE_WAIT:
|
|
||||||
msg->Output.Close.Error = tcp_close(pcb);
|
msg->Output.Close.Error = tcp_close(pcb);
|
||||||
|
|
||||||
if (!msg->Output.Close.Error && msg->Input.Close.Callback)
|
if (!msg->Output.Close.Error && msg->Input.Close.Callback)
|
||||||
|
@ -714,8 +716,9 @@ LibTCPCloseCallback(void *arg)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* Start the graceful close process (or send RST for pending data) */
|
/* Abort the socket */
|
||||||
msg->Output.Close.Error = tcp_close(pcb);
|
tcp_abort(pcb);
|
||||||
|
msg->Output.Close.Error = ERR_OK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue