dexter has uploaded this change for review.

View Change

proto_clnt: close osmo-e1d control socket on connection loss

When osmo-e1d is terminated the socket file descriptor on the client
side will get permanent POLLHUP events. This means that the registered
callback gets called with flags OSMO_FD_READ but the received data will
be of length zero. We must detect this situations and close the file
descriptor on connection loss. Otherwise we would get called over and
over again in an endless loop, resulting in 100% CPU usage.

Related: OS#5983
Change-Id: I3e1a29a9701a9432f58ef7cfedc32c916203017a
---
M src/proto_clnt.c
1 file changed, 22 insertions(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/88/32388/1
diff --git a/src/proto_clnt.c b/src/proto_clnt.c
index c703432..5b9a467 100644
--- a/src/proto_clnt.c
+++ b/src/proto_clnt.c
@@ -88,8 +88,12 @@
struct osmo_e1dp_msg_hdr *hdr;

msgb = osmo_e1dp_recv(ofd, NULL);
- if (!msgb)
+ if (!msgb) {
+ LOGP(DE1D, LOGL_ERROR, "Lost connection with osmo-e1d control socket.\n");
+ close(ofd->fd);
+ ofd->fd = 0;
goto err;
+ }

hdr = msgb_l1(msgb);
if ((hdr->type & E1DP_TYPE_MSK) != E1DP_EVT_TYPE)

To view, visit change 32388. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I3e1a29a9701a9432f58ef7cfedc32c916203017a
Gerrit-Change-Number: 32388
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier@sysmocom.de>
Gerrit-MessageType: newchange