\r
\r
/**\r
- Worker routine for ::Accept and ::AcceptNB\r
+ Worker routine for ::accept and ::AcceptNB\r
\r
- @param [in] s Socket file descriptor returned from ::socket.\r
+ @param [in] s Socket file descriptor returned from ::socket.\r
\r
- @param [in] bBlocking TRUE if this is a blocking call\r
- @param [in] address Address of a buffer to receive the remote network address.\r
+ @param [in] bBlockingAllowed TRUE if this is a blocking call\r
+ @param [in] address Address of a buffer to receive the remote network address.\r
\r
@param [in, out] address_len Address of a buffer containing the Length in bytes\r
of the remote network address buffer. Upon return,\r
contains the length of the remote network address.\r
\r
- @returns ::accept returns zero if successful and -1 when an error occurs.\r
- In the case of an error, errno contains more details.\r
+ @return AcceptWork returns zero if successful and -1 when an error occurs.\r
+ In the case of an error, ::errno contains more details.\r
\r
**/\r
int\r
AcceptWork (\r
int s,\r
- BOOLEAN bBlocking,\r
+ BOOLEAN bBlockingAllowed,\r
struct sockaddr * address,\r
socklen_t * address_len\r
)\r
{\r
+ BOOLEAN bBlocking;\r
INT32 NewSocketFd;\r
struct __filedes * pDescriptor;\r
EFI_SOCKET_PROTOCOL * pNewSocket;\r
&errno );\r
if ( NULL != pSocketProtocol ) {\r
//\r
- // TODO: Update bBlocking by anding with check for NON_BLOCKING\r
+ // Determine if the operation is blocking\r
//\r
+ bBlocking = (BOOLEAN)( 0 == ( pDescriptor->Oflags & O_NONBLOCK ));\r
+ bBlocking &= bBlockingAllowed;\r
\r
//\r
// Attempt to accept a new network connection\r
//\r
// Convert the protocol to a socket\r
//\r
- NewSocketFd = BslSocketProtocolToFd ( pNewSocket, &errno );\r
- if ( -1 == NewSocketFd ) {\r
- //\r
- // Close the socket\r
- //\r
- BslSocketCloseWork ( pNewSocket, NULL );\r
+ if ( !EFI_ERROR ( Status )) {\r
+ NewSocketFd = BslSocketProtocolToFd ( pNewSocket, &errno );\r
+ if ( -1 == NewSocketFd ) {\r
+ //\r
+ // Close the socket\r
+ //\r
+ BslSocketCloseWork ( pNewSocket, NULL );\r
+ }\r
}\r
}\r
\r
/**\r
Accept a network connection.\r
\r
- The ::accept routine waits for a network connection to the socket.\r
- It is able to return the remote network address to the caller if\r
- requested. The\r
+ The accept routine waits for a network connection to the socket.\r
+ It returns the remote network address to the caller if requested.\r
+\r
+ The\r
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/accept.html">POSIX</a>\r
documentation is available online.\r
\r
of the remote network address buffer. Upon return,\r
contains the length of the remote network address.\r
\r
- @returns ::accept returns zero if successful and -1 when an error occurs.\r
- In the case of an error, errno contains more details.\r
+ @return The accept routine returns zero if successful and -1 when an error occurs.\r
+ In the case of an error, ::errno contains more details.\r
\r
**/\r
int\r
\r
\r
/**\r
- Non blocking version of accept.\r
-\r
- See ::accept\r
+ Non blocking version of ::accept.\r
\r
@param [in] s Socket file descriptor returned from ::socket.\r
\r
of the remote network address buffer. Upon return,\r
contains the length of the remote network address.\r
\r
- @returns This routine returns zero if successful and -1 when an error occurs.\r
- In the case of an error, errno contains more details.\r
+ @return This routine returns zero if successful and -1 when an error occurs.\r
+ In the case of an error, ::errno contains more details.\r
\r
**/\r
int\r