You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The tcp transport class (TCPTransport) is not signal safe in underlyingReceive. It omits checking the errno value to see if the call was interrupted by a signal. Below is simple patch trying to address this issue.
diff --git a/erpc_c/transports/erpc_tcp_transport.cpp b/erpc_c/transports/erpc_tcp_transport.cpp
index 9712ce6..f755231 100644
--- a/erpc_c/transports/erpc_tcp_transport.cpp
+++ b/erpc_c/transports/erpc_tcp_transport.cpp
@@ -306,7 +306,6 @@ erpc_status_tTCPTransport::close(bool stopServer)
erpc_status_t TCPTransport::underlyingReceive(uint8_t *data, uint32_t size)
{
ssize_t length;
- erpc_status_t status = kErpcStatus_Success;
// Block until we have a valid connection.
#if defined(__MINGW32__)
@@ -334,23 +333,22 @@ erpc_status_tTCPTransport::underlyingReceive(uint8_t *data, uint32_t size)
size -= length;
data += length;
}
+ elseif (length == 0)
+ {
+ // close socket, not server
+ close(false);
+ returnkErpcStatus_ConnectionClosed;
+ }
else
{
- if (length == 0)
- {
- // close socket, not server
- close(false);
- status = kErpcStatus_ConnectionClosed;
- }
- else
+ if (errno != EINTR && errno != EAGAIN)
{
- status = kErpcStatus_ReceiveFailed;
+ returnkErpcStatus_ReceiveFailed;
}
- break;
}
}
- return status;
+ returnkErpcStatus_Success;
}
erpc_status_tTCPTransport::underlyingSend(constuint8_t *data, uint32_t size)
To Reproduce
Send a signal to the program while waiting for a erpc response.
Expected behavior
erpc library should be signal safe.
The text was updated successfully, but these errors were encountered:
Describe the bug
The tcp transport class (
TCPTransport
) is not signal safe inunderlyingReceive
. It omits checking theerrno
value to see if the call was interrupted by a signal. Below is simple patch trying to address this issue.To Reproduce
Send a signal to the program while waiting for a erpc response.
Expected behavior
erpc library should be signal safe.
The text was updated successfully, but these errors were encountered: