mirror of
https://github.com/reactos/reactos.git
synced 2025-06-30 18:51:21 +00:00
[LWIP] Use tcp_close when both shut_rx and shut_tx are set. Fixes CORE-16868 (#2582)
This commit is contained in:
parent
c2dbc18660
commit
666bac44c0
1 changed files with 17 additions and 4 deletions
|
@ -647,11 +647,24 @@ LibTCPShutdownCallback(void *arg)
|
||||||
* PCB without telling us if we shutdown TX and RX. To avoid these problems, we'll clear the
|
* PCB without telling us if we shutdown TX and RX. To avoid these problems, we'll clear the
|
||||||
* socket context if we have called shutdown for TX and RX.
|
* socket context if we have called shutdown for TX and RX.
|
||||||
*/
|
*/
|
||||||
if (msg->Input.Shutdown.shut_rx) {
|
if (msg->Input.Shutdown.shut_rx != msg->Input.Shutdown.shut_tx) {
|
||||||
msg->Output.Shutdown.Error = tcp_shutdown(pcb, TRUE, FALSE);
|
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->Input.Shutdown.shut_tx) {
|
else if (msg->Input.Shutdown.shut_rx) {
|
||||||
msg->Output.Shutdown.Error = tcp_shutdown(pcb, FALSE, TRUE);
|
/* We received both RX and TX requests, which seems to mean closing connection from TDI.
|
||||||
|
* So call tcp_close, otherwise we risk to be put in TCP_WAIT_* states, which makes further
|
||||||
|
* attempts to close the socket to fail in this state.
|
||||||
|
*/
|
||||||
|
msg->Output.Shutdown.Error = tcp_close(pcb);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* This case shouldn't happen */
|
||||||
|
DbgPrint("Requested socket shutdown(0, 0) !\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!msg->Output.Shutdown.Error)
|
if (!msg->Output.Shutdown.Error)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue