Re: [edk2] [PATCH] NetworkPkg/HttpDxe: Missing CloseEvent() in HttpResponseWorker

2015-11-06 Thread Fu, Siyuan
Hegde,

The patch is good.

Reviewed-by: Fu Siyuan <siyuan...@intel.com>


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Nagaraj 
Hegde
Sent: Tuesday, November 3, 2015 5:11 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting...@intel.com>; Fu, Siyuan <siyuan...@intel.com>; Nagaraj 
Hegde <nagaraj-p.he...@hpe.com>
Subject: [edk2] [PATCH] NetworkPkg/HttpDxe: Missing CloseEvent() in 
HttpResponseWorker

Two additional scenarios in which CloseEvent() needs to be called:

We sent a Request to HTTP server, following which we did a
Response() call, with the intent of capturing only the headers.
In this case, we execute an if condition in HttpResponseWorker do a goto Exit. 
HttpDxe will cache the body that it received for which we dint ask for right 
now. After we have received the headers, we call a Response() again. Now, we 
get the data out of cache and again do a goto Exit. In both cases, two 
CreateEvent() are called, one on Event in RxToken in Wrap structure and another 
on Event in RxToken in HttpInstance structure. In Exit label, we are missing 
the CloseEvent() call for both the Events created.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Nagaraj Hegde <nagaraj-p.he...@hpe.com>
---
 NetworkPkg/HttpDxe/HttpImpl.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c 
index 3094400..0e7e60d 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -1130,6 +1130,18 @@ Exit:
   }
   Token->Status = Status;
   gBS->SignalEvent (Token->Event);
+
+  if (Wrap != NULL) {
+if (Wrap->TcpWrap.RxToken.CompletionToken.Event != NULL) {
+  gBS->CloseEvent (Wrap->TcpWrap.RxToken.CompletionToken.Event);
+}
+  }
+
+  if (HttpInstance->RxToken.CompletionToken.Event != NULL) {
+gBS->CloseEvent (HttpInstance->RxToken.CompletionToken.Event);
+HttpInstance->RxToken.CompletionToken.Event = NULL;  }
+
   FreePool (Wrap);
   return Status;
 
--
2.6.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] NetworkPkg/HttpDxe: Missing CloseEvent() in HttpResponseWorker

2015-11-03 Thread Nagaraj Hegde
Two additional scenarios in which CloseEvent() needs to be called:

We sent a Request to HTTP server, following which we did a
Response() call, with the intent of capturing only the headers.
In this case, we execute an if condition in HttpResponseWorker do
a goto Exit. HttpDxe will cache the body that it received for which
we dint ask for right now. After we have received the headers, we
call a Response() again. Now, we get the data out of cache and
again do a goto Exit. In both cases, two CreateEvent() are called,
one on Event in RxToken in Wrap structure and another on Event in
RxToken in HttpInstance structure. In Exit label, we are missing
the CloseEvent() call for both the Events created.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Nagaraj Hegde 
---
 NetworkPkg/HttpDxe/HttpImpl.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/NetworkPkg/HttpDxe/HttpImpl.c b/NetworkPkg/HttpDxe/HttpImpl.c
index 3094400..0e7e60d 100644
--- a/NetworkPkg/HttpDxe/HttpImpl.c
+++ b/NetworkPkg/HttpDxe/HttpImpl.c
@@ -1130,6 +1130,18 @@ Exit:
   }
   Token->Status = Status;
   gBS->SignalEvent (Token->Event);
+
+  if (Wrap != NULL) {
+if (Wrap->TcpWrap.RxToken.CompletionToken.Event != NULL) {
+  gBS->CloseEvent (Wrap->TcpWrap.RxToken.CompletionToken.Event);
+}
+  }
+
+  if (HttpInstance->RxToken.CompletionToken.Event != NULL) {
+gBS->CloseEvent (HttpInstance->RxToken.CompletionToken.Event);
+HttpInstance->RxToken.CompletionToken.Event = NULL;
+  }
+
   FreePool (Wrap);
   return Status;
 
-- 
2.6.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel