mirror of
https://github.com/reactos/reactos.git
synced 2024-09-13 06:11:59 +00:00
[lwIP/TCPIP]
- Fix completing IRPs with 0 bytes received when getting the data from the connection's packet queue - Eliminate memory leaks caused by unreleased pbufs - Get rid of some commented code In principle the speed issue with lwIP should be pretty much solved now. There's still some minor things to iron out that testing will reveal probably. Initial tests like running opera, downloading stuff etc seem to be very encouraging however. svn path=/branches/GSoC_2011/TcpIpDriver/; revision=52894
This commit is contained in:
parent
646142ffcf
commit
ddd3bd5f7a
|
@ -46,7 +46,6 @@ BucketCompletionWorker(PVOID Context)
|
|||
ExFreePoolWithTag(Bucket, TDI_BUCKET_TAG);
|
||||
}
|
||||
|
||||
static
|
||||
VOID
|
||||
CompleteBucket(PCONNECTION_ENDPOINT Connection, PTDI_BUCKET Bucket, BOOLEAN Synchronous)
|
||||
{
|
||||
|
@ -149,23 +148,11 @@ TCPFinEventHandler(void *arg, err_t err)
|
|||
DbgPrint("[IP, TCPFinEventHandler] Called for Connection( 0x%x )-> SocketContext = pcb (0x%x)\n", Connection, Connection->SocketContext);
|
||||
|
||||
/* Only clear the pointer if the shutdown was caused by an error */
|
||||
if ((err != ERR_OK))// && (status != STATUS_REMOTE_DISCONNECT))
|
||||
if ((err != ERR_OK))
|
||||
{
|
||||
/* We're already closed by the error so we don't want to call lwip_close */
|
||||
DbgPrint("[IP, TCPFinEventHandler] MAKING Connection( 0x%x )-> SocketContext = pcb (0x%x) NULL\n", Connection, Connection->SocketContext);
|
||||
|
||||
// close all possible callbacks
|
||||
/*tcp_arg((PTCP_PCB)Connection->SocketContext, NULL);
|
||||
|
||||
if (((PTCP_PCB)Connection->SocketContext)->state != LISTEN)
|
||||
{
|
||||
tcp_recv((PTCP_PCB)Connection->SocketContext, NULL);
|
||||
tcp_sent((PTCP_PCB)Connection->SocketContext, NULL);
|
||||
tcp_err((PTCP_PCB)Connection->SocketContext, NULL);
|
||||
}
|
||||
|
||||
tcp_accept((PTCP_PCB)Connection->SocketContext, NULL);*/
|
||||
|
||||
Connection->SocketContext = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -428,7 +428,7 @@ NTSTATUS TCPReceiveData
|
|||
|
||||
/* Freed in TCPSocketState */
|
||||
Bucket = ExAllocatePoolWithTag( NonPagedPool, sizeof(*Bucket), TDI_BUCKET_TAG );
|
||||
if( !Bucket )
|
||||
if (!Bucket)
|
||||
{
|
||||
TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Failed to allocate bucket\n"));
|
||||
UnlockObject(Connection, OldIrql);
|
||||
|
@ -438,20 +438,25 @@ NTSTATUS TCPReceiveData
|
|||
|
||||
Bucket->Request.RequestNotifyObject = Complete;
|
||||
Bucket->Request.RequestContext = Context;
|
||||
*BytesReceived = 0;
|
||||
|
||||
|
||||
InsertTailList( &Connection->ReceiveRequest, &Bucket->Entry );
|
||||
TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Queued read irp\n"));
|
||||
|
||||
UnlockObject(Connection, OldIrql);
|
||||
|
||||
TI_DbgPrint(DEBUG_TCP,("[IP, TCPReceiveData] Leaving. Status = STATUS_PENDING\n"));
|
||||
|
||||
(*BytesReceived) = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
(*BytesReceived) = Received;
|
||||
}
|
||||
|
||||
DbgPrint("[IP, TCPReceiveData] Leaving. Status = %s\n",
|
||||
Status == STATUS_PENDING? "STATUS_PENDING" : "STATUS_SUCCESS");
|
||||
|
||||
return STATUS_PENDING;
|
||||
return Status;
|
||||
}
|
||||
|
||||
NTSTATUS TCPSendData
|
||||
|
|
|
@ -47,7 +47,7 @@ LibTCPEmptyQueue(PCONNECTION_ENDPOINT Connection)
|
|||
qp = CONTAINING_RECORD(Entry, QUEUE_ENTRY, ListEntry);
|
||||
|
||||
// reenable this later
|
||||
//pbuf_free(qp->p);
|
||||
pbuf_free(qp->p);
|
||||
|
||||
ExFreePoolWithTag(qp, LWIP_TAG);
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ NTSTATUS LibTCPGetDataFromConnectionQueue(PCONNECTION_ENDPOINT Connection, PUCHA
|
|||
|
||||
RecvLen = MIN(p->tot_len, RecvLen);
|
||||
|
||||
for ((*Received) = 0; (*Received) < RecvLen; *Received += p->len, p = p->next)
|
||||
for ((*Received) = 0; (*Received) < RecvLen; (*Received) += p->len, p = p->next)
|
||||
{
|
||||
DbgPrint("[lwIP, LibTCPGetDataFromConnectionQueue] 0x%x: Copying %d bytes to 0x%x from 0x%x\n",
|
||||
p, p->len, ((PUCHAR)RecvBuffer) + (*Received), p->payload);
|
||||
|
@ -101,7 +101,7 @@ NTSTATUS LibTCPGetDataFromConnectionQueue(PCONNECTION_ENDPOINT Connection, PUCHA
|
|||
}
|
||||
|
||||
// reenable this later
|
||||
//pbuf_free(qp->p);
|
||||
pbuf_free(qp->p);
|
||||
ExFreePoolWithTag(qp, LWIP_TAG);
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
|
|
Loading…
Reference in a new issue