aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2023-04-20 14:28:28 +0200
committerPhilipp Maier <pmaier@sysmocom.de>2023-04-20 14:38:17 +0200
commit9f55c47e7bf168b59381cffd817990e3e412c83d (patch)
tree9f637c10287363fb3de7574c2be6477687bdbe32 /src
parent28c437675fc4c1ea3b37c8a9999f2376ed41b4fe (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/proto_clnt.c6
1 files changed, 5 insertions, 1 deletions
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 @@ _e1dp_client_read(struct osmo_fd *ofd, unsigned int flags)
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)