mirror of
https://github.com/reactos/reactos.git
synced 2024-09-13 06:11:59 +00:00
[lwIP]
- rewrite fix to race condition crash this time in a correct and much more elegant manner svn path=/branches/GSoC_2011/TcpIpDriver/; revision=52730
This commit is contained in:
parent
f0c093af20
commit
356e39f4b7
|
@ -588,7 +588,12 @@ LibTCPShutdownCallback(void *arg)
|
|||
{
|
||||
struct shutdown_callback_msg *msg = arg;
|
||||
|
||||
if (msg->Pcb->state == ESTABLISHED || msg->Pcb->state == SYN_RCVD)
|
||||
{
|
||||
msg->Error = tcp_shutdown(msg->Pcb, msg->shut_rx, msg->shut_tx);
|
||||
}
|
||||
else
|
||||
msg->Error = ERR_OK;
|
||||
|
||||
KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
|
@ -599,7 +604,7 @@ LibTCPShutdown(struct tcp_pcb *pcb, const int shut_rx, const int shut_tx)
|
|||
struct shutdown_callback_msg *msg;
|
||||
err_t ret;
|
||||
|
||||
DbgPrint("[lwIP, LibTCPShutdown] Called on pcb = 0x%x\n", pcb);
|
||||
DbgPrint("[lwIP, LibTCPShutdown] Called on pcb = 0x%x with rx = %d, tx = %d\n", pcb, shut_rx, shut_tx);
|
||||
|
||||
if (!pcb)
|
||||
{
|
||||
|
@ -607,7 +612,7 @@ LibTCPShutdown(struct tcp_pcb *pcb, const int shut_rx, const int shut_tx)
|
|||
return ERR_CLSD;
|
||||
}
|
||||
|
||||
DbgPrint("[lwIP, LibTCPClose] pcb->state = %s\n", tcp_state_str[pcb->state]);
|
||||
DbgPrint("[lwIP, LibTCPShutdown] pcb->state = %s\n", tcp_state_str[pcb->state]);
|
||||
|
||||
msg = ExAllocatePool(NonPagedPool, sizeof(struct shutdown_callback_msg));
|
||||
if (msg)
|
||||
|
@ -658,19 +663,18 @@ LibTCPCloseCallback(void *arg)
|
|||
DbgPrint("[lwIP, LibTCPCloseCallback] Closing a listener\n");
|
||||
msg->Error = tcp_close(msg->Pcb);
|
||||
}
|
||||
else if (msg->Pcb->state != LAST_ACK && msg->Pcb->state != CLOSED)
|
||||
else
|
||||
{
|
||||
DbgPrint("[lwIP, LibTCPCloseCallback] Aborting a connection\n");
|
||||
tcp_abort(msg->Pcb);
|
||||
msg->Error = ERR_OK;
|
||||
}
|
||||
else
|
||||
msg->Error = ERR_OK;
|
||||
|
||||
KeSetEvent(&msg->Event, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
|
||||
err_t
|
||||
//LibTCPClose(struct tcp_pcb *pcb, const int safe)
|
||||
LibTCPClose(struct tcp_pcb *pcb, const int safe)
|
||||
{
|
||||
err_t ret;
|
||||
|
@ -712,14 +716,12 @@ LibTCPClose(struct tcp_pcb *pcb, const int safe)
|
|||
DbgPrint("[lwIP, LibTCPClose] Closing a listener\n");
|
||||
ret = tcp_close(pcb);
|
||||
}
|
||||
else if (pcb->state != LAST_ACK && pcb->state != CLOSED)
|
||||
else
|
||||
{
|
||||
DbgPrint("[lwIP, LibTCPClose] Aborting a connection\n");
|
||||
tcp_abort(pcb);
|
||||
ret = ERR_OK;
|
||||
}
|
||||
else
|
||||
ret = ERR_OK;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue