From 34073fbc97de2db185f746b25fa79b2013d9aa6a Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 8 Jul 2011 20:36:05 +0200 Subject: hsl: close socket if we destroy the signalling link As we do in ipaccess driver, the socket is not useful anymore if the BSC/BTS decides to close the signalling link. --- src/input/hsl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/input/hsl.c b/src/input/hsl.c index 7058f48..9861063 100644 --- a/src/input/hsl.c +++ b/src/input/hsl.c @@ -307,6 +307,19 @@ static int hsl_fd_cb(struct osmo_fd *bfd, unsigned int what) return rc; } +static void hsl_close(struct e1inp_sign_link *sign_link) +{ + struct e1inp_ts *ts = sign_link->ts; + struct osmo_fd *bfd = &ts->driver.ipaccess.fd; + e1inp_event(ts, S_INP_TEI_DN, sign_link->tei, sign_link->sapi); + /* the first e1inp_sign_link_destroy call closes the socket. */ + if (bfd->fd != -1) { + osmo_fd_unregister(bfd); + close(bfd->fd); + bfd->fd = -1; + } +} + static int hsl_line_update(struct e1inp_line *line, enum e1inp_line_role role, const char *addr); @@ -314,6 +327,7 @@ struct e1inp_driver hsl_driver = { .name = "hsl", .want_write = ts_want_write, .line_update = hsl_line_update, + .close = hsl_close, .default_delay = 0, }; -- cgit v1.2.3-55-g7522