aboutsummaryrefslogtreecommitdiffstats
path: root/src/hnbgw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/hnbgw.c')
-rw-r--r--src/hnbgw.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/hnbgw.c b/src/hnbgw.c
index cd492bb..188b292 100644
--- a/src/hnbgw.c
+++ b/src/hnbgw.c
@@ -267,6 +267,15 @@ out:
return rc;
}
+static void txflushed_cb(struct osmo_stream_srv *conn, void *data)
+{
+ struct hnb_context *hnb = osmo_stream_srv_get_data(conn);
+
+ /* Close connection after sending HNB-REGISTER-REJECT and the Tx queue has been flushed. */
+ if (hnb->hnb_rejected)
+ hnb_context_release(hnb);
+}
+
struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_link *link, int new_fd)
{
struct hnb_context *ctx;
@@ -284,6 +293,8 @@ struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_
return NULL;
}
+ osmo_stream_srv_set_txflushed_cb(ctx->conn, txflushed_cb);
+
llist_add_tail(&ctx->list, &gw->hnb_list);
return ctx;
}