hnbgw: Handle closed connections correctly

We still need to clean up the HNB data structures after the connection
is closed
This commit is contained in:
Daniel Willmann 2015-12-15 20:29:27 +01:00
parent 7c27f7b792
commit 4267a29ee0
1 changed files with 12 additions and 1 deletions

View File

@ -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");