Copilot commented on code in PR #802:
URL: https://github.com/apache/celix/pull/802#discussion_r2389635723
##########
bundles/remote_services/remote_service_admin_shm_v2/rsa_shm/src/rsa_shm_server.c:
##########
@@ -291,8 +291,12 @@ static void *rsaShmServer_receiveMsgThread(void *data) {
while (server->revMsgThreadActive) {
revBytes = recvfrom(server->sfd, &msgInfo, sizeof(msgInfo), 0, NULL,
NULL);
- if (revBytes <= 0) {
- celix_logHelper_error(server->loghelper, "RsaShmServer: recv msg
err(%d) or recv zero-length datagrams.", errno);
+ if (revBytes == 0) {
+ celix_logHelper_debug(server->loghelper, "RsaShmServer: recv
zero-length datagrams or the socket is shutdown.");
+ continue;
+ }
+ if (revBytes < 0) {
+ celix_logHelper_error(server->loghelper, "RsaShmServer: recv msg
err(%d).", errno);
continue;
Review Comment:
[nitpick] The error handling separates zero-length and negative return
values, but both cases continue the loop. Consider if zero-length datagrams
should be handled differently or if the loop should break on certain error
conditions to avoid infinite loops.
```suggestion
celix_logHelper_debug(server->loghelper, "RsaShmServer: recv
zero-length datagrams or the socket is shutdown. Exiting receive thread.");
break;
}
if (revBytes < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
celix_logHelper_debug(server->loghelper, "RsaShmServer: recv
msg transient err(%d). Continuing.", errno);
continue;
} else {
celix_logHelper_error(server->loghelper, "RsaShmServer: recv
msg fatal err(%d). Exiting receive thread.", errno);
break;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]