mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:42:57 +00:00
[lwIP]
Fix the nasty crash on socket closure bug. The bug was due to corrupting memory by wrongly assuming the LISTEN pcb had send, receive and error callbacks. svn path=/branches/GSoC_2011/TcpIpDriver/; revision=52385
This commit is contained in:
parent
4b7e0f11d0
commit
b320225fb2
1 changed files with 13 additions and 8 deletions
|
@ -330,20 +330,16 @@ void
|
||||||
LibTCPListenCallback(void *arg)
|
LibTCPListenCallback(void *arg)
|
||||||
{
|
{
|
||||||
struct listen_callback_msg *msg = arg;
|
struct listen_callback_msg *msg = arg;
|
||||||
void *p;
|
|
||||||
|
|
||||||
ASSERT(msg);
|
ASSERT(msg);
|
||||||
|
|
||||||
DbgPrint("[lwIP, LibTCPListenCallback] Called\n");
|
DbgPrint("[lwIP, LibTCPListenCallback] Called\n");
|
||||||
|
|
||||||
p = msg->Pcb->callback_arg;
|
|
||||||
msg->NewPcb = tcp_listen_with_backlog(msg->Pcb, msg->Backlog);
|
msg->NewPcb = tcp_listen_with_backlog(msg->Pcb, msg->Backlog);
|
||||||
|
|
||||||
if (msg->NewPcb)
|
if (msg->NewPcb)
|
||||||
{
|
{
|
||||||
tcp_arg(msg->NewPcb, p);
|
|
||||||
tcp_accept(msg->NewPcb, InternalAcceptEventHandler);
|
tcp_accept(msg->NewPcb, InternalAcceptEventHandler);
|
||||||
tcp_err(msg->NewPcb, InternalErrorEventHandler);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DbgPrint("[lwIP, LibTCPListenCallback] Done\n");
|
DbgPrint("[lwIP, LibTCPListenCallback] Done\n");
|
||||||
|
@ -641,9 +637,18 @@ LibTCPClose(struct tcp_pcb *pcb)
|
||||||
DbgPrint("[lwIP, LibTCPClose] pcb->state = %s\n", tcp_state_str[pcb->state]);
|
DbgPrint("[lwIP, LibTCPClose] pcb->state = %s\n", tcp_state_str[pcb->state]);
|
||||||
|
|
||||||
tcp_arg(pcb, NULL);
|
tcp_arg(pcb, NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
if this pcb is not in LISTEN state than it has
|
||||||
|
valid recv, send and err callbacks to cancel
|
||||||
|
*/
|
||||||
|
if (pcb->state != LISTEN)
|
||||||
|
{
|
||||||
tcp_recv(pcb, NULL);
|
tcp_recv(pcb, NULL);
|
||||||
tcp_sent(pcb, NULL);
|
tcp_sent(pcb, NULL);
|
||||||
tcp_err(pcb, NULL);
|
tcp_err(pcb, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
tcp_accept(pcb, NULL);
|
tcp_accept(pcb, NULL);
|
||||||
|
|
||||||
DbgPrint("[lwIP, LibTCPClose] Attempting to allocate memory for msg\n");
|
DbgPrint("[lwIP, LibTCPClose] Attempting to allocate memory for msg\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue