diff options
author | Daniel Willmann <dwillmann@sysmocom.de> | 2015-12-15 20:29:27 +0100 |
---|---|---|
committer | Daniel Willmann <dwillmann@sysmocom.de> | 2015-12-17 13:09:18 +0100 |
commit | 4267a29ee0d301a653aa04c5b94488a5282a80c4 (patch) | |
tree | 790878571aa7a8c08a2bfcee5c394dd158a54827 /src | |
parent | 7c27f7b7922f4fa8137b36d41082f14adc14b180 (diff) |
hnbgw: Handle closed connections correctly
We still need to clean up the HNB data structures after the connection
is closed
Diffstat (limited to 'src')
-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"); |