]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/DxeTcpIoLib/DxeTcpIoLib.c
MdeModulePkg/TcpIoLib: Check input Timeout before calling CheckEvent() service.
[mirror_edk2.git] / MdeModulePkg / Library / DxeTcpIoLib / DxeTcpIoLib.c
index 17183e1a6c818df61f2e1715b02f4d0259de140b..a7637579f2c17a93eff09fce176fafceaa5fe2b7 100644 (file)
@@ -2,7 +2,7 @@
   This library is used to share code between UEFI network stack modules.\r
   It provides the helper routines to access TCP service.\r
 \r
-Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at<BR>\r
@@ -530,7 +530,7 @@ TcpIoDestroySocket (
   Connect to the other endpoint of the TCP socket.\r
 \r
   @param[in, out]  TcpIo     The TcpIo wrapping the TCP socket.\r
-  @param[in]       Timeout   The time to wait for connection done.\r
+  @param[in]       Timeout   The time to wait for connection done. Set to NULL for infinite wait.\r
   \r
   @retval EFI_SUCCESS            Connect to the other endpoint of the TCP socket\r
                                  successfully.\r
@@ -546,7 +546,7 @@ EFI_STATUS
 EFIAPI\r
 TcpIoConnect (\r
   IN OUT TCP_IO             *TcpIo,\r
-  IN     EFI_EVENT          Timeout\r
+  IN     EFI_EVENT          Timeout        OPTIONAL\r
   )\r
 {\r
   EFI_TCP4_PROTOCOL         *Tcp4;\r
@@ -576,7 +576,7 @@ TcpIoConnect (
     return Status;\r
   }\r
 \r
-  while (!TcpIo->IsConnDone && EFI_ERROR (gBS->CheckEvent (Timeout))) {\r
+  while (!TcpIo->IsConnDone && ((Timeout == NULL) || EFI_ERROR (gBS->CheckEvent (Timeout)))) {\r
     if (TcpIo->TcpVersion == TCP_VERSION_4) {\r
       Tcp4->Poll (Tcp4);\r
     } else {\r
@@ -597,7 +597,7 @@ TcpIoConnect (
   Accept the incomding request from the other endpoint of the TCP socket.\r
 \r
   @param[in, out]  TcpIo     The TcpIo wrapping the TCP socket.\r
-  @param[in]       Timeout   The time to wait for connection done.\r
+  @param[in]       Timeout   The time to wait for connection done. Set to NULL for infinite wait.\r
 \r
   \r
   @retval EFI_SUCCESS            Connect to the other endpoint of the TCP socket\r
@@ -607,7 +607,7 @@ TcpIoConnect (
                                  supported in the implementation.\r
 \r
   @retval EFI_TIMEOUT            Failed to connect to the other endpoint of the\r
-                                 TCP socket in the specified time period.                      \r
+                                 TCP socket in the specified time period.\r
   @retval Others                 Other errors as indicated.\r
 \r
 **/\r
@@ -615,7 +615,7 @@ EFI_STATUS
 EFIAPI\r
 TcpIoAccept (\r
   IN OUT TCP_IO             *TcpIo,\r
-  IN     EFI_EVENT          Timeout\r
+  IN     EFI_EVENT          Timeout        OPTIONAL\r
   )\r
 {\r
   EFI_STATUS                Status;\r
@@ -646,7 +646,7 @@ TcpIoAccept (
     return Status;\r
   }\r
 \r
-  while (!TcpIo->IsListenDone && EFI_ERROR (gBS->CheckEvent (Timeout))) {\r
+  while (!TcpIo->IsListenDone && ((Timeout == NULL) || EFI_ERROR (gBS->CheckEvent (Timeout)))) {\r
     if (TcpIo->TcpVersion == TCP_VERSION_4) {\r
       Tcp4->Poll (Tcp4);\r
     } else {\r
@@ -860,7 +860,7 @@ ON_EXIT:
   @param[in]       Packet      The buffer to hold the data copy from the socket rx buffer.\r
   @param[in]       AsyncMode   Is this receive asyncronous or not.\r
   @param[in]       Timeout     The time to wait for receiving the amount of data the Packet\r
-                               can hold.\r
+                               can hold. Set to NULL for infinite wait.\r
 \r
   @retval EFI_SUCCESS            The required amount of data is received from the socket.\r
   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.\r
@@ -877,7 +877,7 @@ TcpIoReceive (
   IN OUT TCP_IO             *TcpIo,\r
   IN     NET_BUF            *Packet,\r
   IN     BOOLEAN            AsyncMode,\r
-  IN     EFI_EVENT          Timeout\r
+  IN     EFI_EVENT          Timeout       OPTIONAL\r
   )\r
 {\r
   EFI_TCP4_PROTOCOL         *Tcp4;\r