Skip to content

Commit

Permalink
Handle sendto() function failure conditions
Browse files Browse the repository at this point in the history
The sendto() function can fail because of  multiple conditions.
Currently we are handling few conditions. If there is an error due
to another condition, the process gets stuck in repeatedly trying
to call sendto() function and failing with the same error condition.
For example, when awa session is established and after that
network interface goes down(ex. ethernet cable is removed),
the sendto() fuction fails with error 'ENETUNREACH'. This error
is not handled and the process gets stuck in repeatedly calling
sendto() fuction. There are also other possible error conditions.
In this change handling all error conditions, so that process
does not get stuck in endless loop.

Ref: AWA-311
Signed-off-by: Pranit Tanaji Sirsat <[email protected]>
  • Loading branch information
pranit-sirsat-imgtec authored and cheekyhalf committed Jan 20, 2017
1 parent 9e0a600 commit e9e2c84
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions core/src/common/network_abstraction_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,21 +780,11 @@ bool sendUDP(NetworkSocket * networkSocket, NetworkAddress * destAddress, const
int lastError = errno;
if (sentBytes == SOCKET_ERROR)
{
if (lastError == EWOULDBLOCK)
if ((lastError == EWOULDBLOCK) || (lastError == EINTR))
{
sentBytes = 0;
}
else if (lastError == ENOTCONN)
{
networkSocket->LastError = NetworkSocketError_SendError;
break;
}
else if (lastError == ECONNRESET)
{
networkSocket->LastError = NetworkSocketError_SendError;
break;
}
else if (lastError == EBADF)
else
{
networkSocket->LastError = NetworkSocketError_SendError;
break;
Expand Down

0 comments on commit e9e2c84

Please sign in to comment.