Update the sockets library code
* Passes conformance and functional tests. * Builds with GCC 4.4 compiler. Signed-off by: lpleahy git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12497 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -18,7 +18,11 @@
|
||||
/**
|
||||
Send data using a network connection.
|
||||
|
||||
The ::send routine queues data to the network for transmission.
|
||||
The sendto routine queues data to the network for transmission.
|
||||
This routine is typically used for SOCK_DGRAM sockets that are shared
|
||||
between multiple machine where it is required to specify the target
|
||||
system address when sending the data.
|
||||
|
||||
The
|
||||
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/send.html">POSIX</a>
|
||||
documentation is available online.
|
||||
@@ -35,9 +39,9 @@
|
||||
|
||||
@param [in] tolen Length of remote system address structure
|
||||
|
||||
@return ::send returns the number of data bytes that were
|
||||
@return This routine returns the number of data bytes that were
|
||||
sent and -1 when an error occurs. In the case of
|
||||
an error, errno contains more details.
|
||||
an error, ::errno contains more details.
|
||||
|
||||
**/
|
||||
ssize_t
|
||||
@@ -50,6 +54,7 @@ sendto (
|
||||
socklen_t tolen
|
||||
)
|
||||
{
|
||||
BOOLEAN bBlocking;
|
||||
ssize_t LengthInBytes;
|
||||
CONST UINT8 * pData;
|
||||
struct __filedes * pDescriptor;
|
||||
@@ -68,20 +73,25 @@ sendto (
|
||||
&pDescriptor,
|
||||
&errno );
|
||||
if ( NULL != pSocketProtocol ) {
|
||||
//
|
||||
// Determine if the operation is blocking
|
||||
//
|
||||
bBlocking = (BOOLEAN)( 0 == ( pDescriptor->Oflags & O_NONBLOCK ));
|
||||
|
||||
//
|
||||
// Send the data using the socket
|
||||
//
|
||||
pData = buffer;
|
||||
do {
|
||||
errno = 0;
|
||||
Status = pSocketProtocol->pfnSend ( pSocketProtocol,
|
||||
flags,
|
||||
length,
|
||||
pData,
|
||||
(size_t *)&LengthInBytes,
|
||||
to,
|
||||
tolen,
|
||||
&errno );
|
||||
Status = pSocketProtocol->pfnTransmit ( pSocketProtocol,
|
||||
flags,
|
||||
length,
|
||||
pData,
|
||||
(size_t *)&LengthInBytes,
|
||||
to,
|
||||
tolen,
|
||||
&errno );
|
||||
if ( EFI_ERROR ( Status ) && ( EFI_NOT_READY != Status )) {
|
||||
LengthInBytes = -1;
|
||||
break;
|
||||
@@ -92,8 +102,7 @@ sendto (
|
||||
//
|
||||
pData += LengthInBytes;
|
||||
length -= LengthInBytes;
|
||||
// TODO: Add non-blocking check
|
||||
} while (( 0 != length ) && ( EFI_NOT_READY == Status ));
|
||||
} while (( 0 != length ) && ( EFI_NOT_READY == Status ) && bBlocking );
|
||||
}
|
||||
|
||||
//
|
||||
|
Reference in New Issue
Block a user