aboutsummaryrefslogtreecommitdiffstats
path: root/src/e1_input.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-12-28 19:47:07 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-12-28 19:47:07 +0100
commit55467f0478e37b35cceec3051c645b8a407110bc (patch)
tree15efd172f31d0fc095a36dd6e28f19d558b4d2dd /src/e1_input.c
parentd73c84670b0f74f502d28acbcbbeb672cf8ee4f9 (diff)
abis/close: Deliver S_L_INP_TEI_DN when closing the socketv0.1.1
* HSL/IPA had different socket closing code for the same thing, create one method for it. * Both methods tried to send an event but as we are on the close path the sign_link was already removed from the list and the input event sending method couldn't find the sign_link using the sapi/tei provided.
Diffstat (limited to 'src/e1_input.c')
-rw-r--r--src/e1_input.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/src/e1_input.c b/src/e1_input.c
index 1bd4744..957b74c 100644
--- a/src/e1_input.c
+++ b/src/e1_input.c
@@ -645,27 +645,46 @@ struct msgb *e1inp_tx_ts(struct e1inp_ts *e1i_ts,
return msg;
}
-/* called by driver in case some kind of link state event */
-int e1inp_event(struct e1inp_ts *ts, int evt, uint8_t tei, uint8_t sapi)
+static int e1inp_int_snd_event(struct e1inp_ts *ts,
+ struct e1inp_sign_link *link, int evt)
{
- struct e1inp_sign_link *link;
struct input_signal_data isd;
-
- link = e1inp_lookup_sign_link(ts, tei, sapi);
- if (!link)
- return -EINVAL;
-
isd.line = ts->line;
isd.link_type = link->type;
isd.trx = link->trx;
- isd.tei = tei;
- isd.sapi = sapi;
+ isd.tei = link->tei;
+ isd.sapi = link->sapi;
/* report further upwards */
osmo_signal_dispatch(SS_L_INPUT, evt, &isd);
return 0;
}
+
+/* called by driver in case some kind of link state event */
+int e1inp_event(struct e1inp_ts *ts, int evt, uint8_t tei, uint8_t sapi)
+{
+ struct e1inp_sign_link *link;
+
+ link = e1inp_lookup_sign_link(ts, tei, sapi);
+ if (!link)
+ return -EINVAL;
+ return e1inp_int_snd_event(ts, link, evt);
+}
+
+void e1inp_close_socket(struct e1inp_ts *ts,
+ struct e1inp_sign_link *sign_link,
+ struct osmo_fd *bfd)
+{
+ e1inp_int_snd_event(ts, sign_link, S_L_INP_TEI_DN);
+ /* the first e1inp_sign_link_destroy call closes the socket. */
+ if (bfd->fd != -1) {
+ osmo_fd_unregister(bfd);
+ close(bfd->fd);
+ bfd->fd = -1;
+ }
+}
+
/* register a driver with the E1 core */
int e1inp_driver_register(struct e1inp_driver *drv)
{