Better handle transmit errors

Return 0 receive bytes when socket is closed


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12099 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lpleahy
2011-08-08 18:19:45 +00:00
parent 42372879b5
commit 1c34b250f6
2 changed files with 250 additions and 223 deletions

View File

@@ -2448,13 +2448,21 @@ EslTcpReceive4 (
&& ( NULL == pSocket->pRxPacketListHead )
&& ( NULL == pSocket->pRxOobPacketListHead )) {
Status = pSocket->RxError;
pSocket->RxError = EFI_SUCCESS;
switch ( Status ) {
default:
pSocket->errno = EIO;
break;
case EFI_CONNECTION_FIN:
pSocket->errno = ESHUTDOWN;
//
// Continue to return zero bytes received when the
// peer has successfully closed the connection
//
pSocket->RxError = EFI_CONNECTION_FIN;
*pDataLength = 0;
pSocket->errno = 0;
Status = EFI_SUCCESS;
break;
case EFI_CONNECTION_REFUSED:
@@ -2481,7 +2489,6 @@ EslTcpReceive4 (
pSocket->errno = ENOPROTOOPT;
break;
}
pSocket->RxError = EFI_SUCCESS;
}
else {
Status = EFI_NOT_READY;