destroy hnb context from the txflush() callback
These are the osmo-iuh changes corresponding to the libosmo-netif branch 'destroy_conn_with_txflush_callback'. Change-Id: I380e9e41161cbf51b272c7f3725ccaeef625546c
This commit is contained in:
parent
cc6ed397a6
commit
251e1d698d
|
@ -101,6 +101,10 @@ struct hnb_context {
|
||||||
* this entire data structure is freed if the HNB sends HNB-DE-REGISTER-REQ. */
|
* this entire data structure is freed if the HNB sends HNB-DE-REGISTER-REQ. */
|
||||||
bool hnb_registered;
|
bool hnb_registered;
|
||||||
|
|
||||||
|
/*! True if a HNB-REGISTER-REJECT has been sent to this HNB. If this flag
|
||||||
|
* is set we will close the connection once its Tx queue has been flushed. */
|
||||||
|
bool hnb_rejected;
|
||||||
|
|
||||||
/* linked list of hnbgw_context_map */
|
/* linked list of hnbgw_context_map */
|
||||||
struct llist_head map_list;
|
struct llist_head map_list;
|
||||||
};
|
};
|
||||||
|
|
11
src/hnbgw.c
11
src/hnbgw.c
|
@ -267,6 +267,15 @@ out:
|
||||||
return rc;
|
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 *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_link *link, int new_fd)
|
||||||
{
|
{
|
||||||
struct hnb_context *ctx;
|
struct hnb_context *ctx;
|
||||||
|
@ -284,6 +293,8 @@ struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
osmo_stream_srv_set_txflushed_cb(ctx->conn, txflushed_cb);
|
||||||
|
|
||||||
llist_add_tail(&ctx->list, &gw->hnb_list);
|
llist_add_tail(&ctx->list, &gw->hnb_list);
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
|
@ -428,7 +428,15 @@ static int hnbgw_rx_hnb_register_req(struct hnb_context *ctx, ANY_t *in)
|
||||||
"MCC=%u,MNC=%u,LAC=%u,RAC=%u,SAC=%u,CID=%u from %s\n",
|
"MCC=%u,MNC=%u,LAC=%u,RAC=%u,SAC=%u,CID=%u from %s\n",
|
||||||
ctx->id.mcc, ctx->id.mnc, ctx->id.lac, ctx->id.rac, ctx->id.sac, ctx->id.cid, name);
|
ctx->id.mcc, ctx->id.mnc, ctx->id.lac, ctx->id.rac, ctx->id.sac, ctx->id.cid, name);
|
||||||
talloc_free(name);
|
talloc_free(name);
|
||||||
return hnbgw_tx_hnb_register_rej(ctx);
|
rc = hnbgw_tx_hnb_register_rej(ctx);
|
||||||
|
if (rc != 0) {
|
||||||
|
/* The message was not queued. Clean up HNB right away. */
|
||||||
|
hnb_context_release(ctx);
|
||||||
|
} else {
|
||||||
|
/* Release the HNB once the message has been sent. */
|
||||||
|
ctx->hnb_rejected = true;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue