destroy hnb context by setting a flag in msgb control buffer
These are the osmo-iuh changes corresponding to the libosmo-netif branch 'destroy_conn_with_cb_flag'. Change-Id: I62e6d4fe4da75f1a56abf4c46a2426d17840025f
This commit is contained in:
parent
cc6ed397a6
commit
f49b166f4a
|
@ -161,7 +161,7 @@ struct ue_context *ue_context_alloc(struct hnb_context *hnb, const char *imsi,
|
|||
void ue_context_free(struct ue_context *ue);
|
||||
|
||||
struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_link *link, int new_fd);
|
||||
void hnb_context_release(struct hnb_context *ctx);
|
||||
void hnb_context_release(struct hnb_context *ctx, bool destroy_conn);
|
||||
|
||||
void hnbgw_vty_init(struct hnb_gw *gw, void *tall_ctx);
|
||||
int hnbgw_vty_go_parent(struct vty *vty);
|
||||
|
|
15
src/hnbgw.c
15
src/hnbgw.c
|
@ -204,6 +204,11 @@ void ue_context_free(struct ue_context *ue)
|
|||
}
|
||||
static int hnb_close_cb(struct osmo_stream_srv *conn)
|
||||
{
|
||||
struct hnb_context *hnb = osmo_stream_srv_get_data(conn);
|
||||
|
||||
if (hnb)
|
||||
hnb_context_release(hnb, false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -228,10 +233,10 @@ static int hnb_read_cb(struct osmo_stream_srv *conn)
|
|||
} else if (rc < 0) {
|
||||
LOGP(DMAIN, LOGL_ERROR, "Error during sctp_recvmsg()\n");
|
||||
/* FIXME: clean up after disappeared HNB */
|
||||
hnb_context_release(hnb);
|
||||
hnb_context_release(hnb, true);
|
||||
goto out;
|
||||
} else if (rc == 0) {
|
||||
hnb_context_release(hnb);
|
||||
hnb_context_release(hnb, true);
|
||||
rc = -1;
|
||||
|
||||
goto out;
|
||||
|
@ -288,7 +293,7 @@ struct hnb_context *hnb_context_alloc(struct hnb_gw *gw, struct osmo_stream_srv_
|
|||
return ctx;
|
||||
}
|
||||
|
||||
void hnb_context_release(struct hnb_context *ctx)
|
||||
void hnb_context_release(struct hnb_context *ctx, bool destroy_conn)
|
||||
{
|
||||
struct hnbgw_context_map *map, *map2;
|
||||
|
||||
|
@ -305,7 +310,9 @@ void hnb_context_release(struct hnb_context *ctx)
|
|||
context_map_deactivate(map);
|
||||
}
|
||||
ue_context_free_by_hnb(ctx->gw, ctx);
|
||||
osmo_stream_srv_destroy(ctx->conn);
|
||||
|
||||
if (destroy_conn)
|
||||
osmo_stream_srv_destroy(ctx->conn);
|
||||
|
||||
talloc_free(ctx);
|
||||
}
|
||||
|
|
|
@ -77,6 +77,9 @@ static int hnbgw_tx_hnb_register_rej(struct hnb_context *ctx)
|
|||
|
||||
ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_HNBRegisterReject, &reject_out);
|
||||
|
||||
/* Destroy the connection after sending HNB-REGISTER-REJECT. */
|
||||
msgb_netif_destroy_conn_after_tx(msg);
|
||||
|
||||
return hnbgw_hnbap_tx(ctx, msg);
|
||||
}
|
||||
|
||||
|
@ -393,7 +396,7 @@ static int hnbgw_rx_hnb_deregister(struct hnb_context *ctx, ANY_t *in)
|
|||
hnbap_cause_str(&ies.cause));
|
||||
|
||||
hnbap_free_hnbde_registeries(&ies);
|
||||
hnb_context_release(ctx);
|
||||
hnb_context_release(ctx, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue