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: Ib849e0ec1a1cca77eb588076d1d2201594b5c568

Change-Id: I4c8d20917cb6b1d1666b6d73ba2205b5ed7c56b0
---
M src/proto_clnt.c
1 file changed, 24 insertions(+), 1 deletion(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/87/32387/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 32387. To unsubscribe, or for help writing mail filters, visit settings.

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