diff options
-rw-r--r-- | src/hnbgw.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/hnbgw.c b/src/hnbgw.c index d8ef32d..4ab56cd 100644 --- a/src/hnbgw.c +++ b/src/hnbgw.c @@ -136,9 +136,20 @@ static int hnb_read_cb(struct osmo_fd *fd) if (rc < 0) { LOGP(DMAIN, LOGL_ERROR, "Error during sctp_recvmsg()\n"); /* FIXME: clean up after disappeared HNB */ + close(fd->fd); + osmo_fd_unregister(fd); return rc; - } else + } else if (rc == 0) { + LOGP(DMAIN, LOGL_ERROR, "Connection to HNB closed\n"); + /* TODO: Remove all UEs from that connection */ + close(fd->fd); + osmo_fd_unregister(fd); + fd->fd = -1; + + return -1; + } else { msgb_put(msg, rc); + } if (flags & MSG_NOTIFICATION) { LOGP(DMAIN, LOGL_DEBUG, "Ignoring SCTP notification\n"); |