Fix send to properly wait while long transmits are in progress
authorlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 3 Aug 2011 17:45:52 +0000 (17:45 +0000)
committerlpleahy <lpleahy@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 3 Aug 2011 17:45:52 +0000 (17:45 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12083 6f19259b-4bc3-4df7-8a09-765794883524

StdLib/BsdSocketLib/send.c
StdLib/BsdSocketLib/sendto.c

index e0ec643..f3f739c 100644 (file)
@@ -44,54 +44,8 @@ send (
   int flags\r
   )\r
 {\r
-  ssize_t LengthInBytes;\r
-  CONST UINT8 * pData;\r
-  struct __filedes * pDescriptor;\r
-  EFI_SOCKET_PROTOCOL * pSocketProtocol;\r
-  EFI_STATUS Status;\r
-\r
-  //\r
-  //  Assume failure\r
-  //\r
-  LengthInBytes = -1;\r
-\r
-  //\r
-  //  Locate the context for this socket\r
-  //\r
-  pSocketProtocol = BslFdToSocketProtocol ( s,\r
-                                            &pDescriptor,\r
-                                            &errno );\r
-  if ( NULL != pSocketProtocol ) {\r
-    //\r
-    //  Send the data using the socket\r
-    //\r
-    pData = buffer;\r
-    do {\r
-      errno = 0;\r
-      Status = pSocketProtocol->pfnSend ( pSocketProtocol,\r
-                                          flags,\r
-                                          length,\r
-                                          pData,\r
-                                          (size_t *)&LengthInBytes,\r
-                                          NULL,\r
-                                          0,\r
-                                          &errno );\r
-      if ( EFI_ERROR ( Status )) {\r
-        LengthInBytes = -1;\r
-        break;\r
-      }\r
-\r
-      //\r
-      //  Account for the data sent\r
-      //\r
-      pData += LengthInBytes;\r
-      length -= LengthInBytes;\r
-      // TODO: Add non-blocking check\r
-    } while (( 0 != length ) && ( EFI_NOT_READY == Status ));\r
-  }\r
-\r
   //\r
-  //  Return the number of data bytes sent, -1 for errors\r
+  //  Send the data\r
   //\r
-  return (INT32)LengthInBytes;\r
+  return sendto ( s, buffer, length, flags, NULL, 0 );\r
 }\r
index 338eb36..aa6ea8c 100644 (file)
@@ -82,7 +82,7 @@ sendto (
                                           to,\r
                                           tolen,\r
                                           &errno );\r
-      if ( EFI_ERROR ( Status )) {\r
+      if ( EFI_ERROR ( Status ) && ( EFI_NOT_READY != Status )) {\r
         LengthInBytes = -1;\r
         break;\r
       }\r