From 70f74777f36df51e9b404e1f62b65530883cb6fb Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Sun, 28 Oct 2018 13:59:12 +0100 Subject: [PATCH] Correctly implement proto_agent_stop(), call it --- openair2/F1AP/f1ap_cu_task.c | 4 ++++ openair2/LAYER2/PROTO_AGENT/proto_agent.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index e631362226..dc482e7061 100644 --- a/openair2/F1AP/f1ap_cu_task.c +++ b/openair2/F1AP/f1ap_cu_task.c @@ -73,6 +73,10 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat .remote_ipv4_address = RC.rrc[instance]->eth_params_s.remote_addr, .remote_port = RC.rrc[instance]->eth_params_s.remote_portd }; + /* stop, then start the PROTO_AGENT. If it is already stopped, stopping it + * again will do nothing, therefore it is safe to call here. + * TODO: call proto_agent_stop() when CU_TASK is informed about conn release */ + proto_agent_stop(instance); AssertFatal(proto_agent_start(instance, ¶ms) == 0, "could not start PROTO_AGENT for F1U on instance %d!\n", instance); } diff --git a/openair2/LAYER2/PROTO_AGENT/proto_agent.c b/openair2/LAYER2/PROTO_AGENT/proto_agent.c index 0b53f366bc..00441aeed5 100644 --- a/openair2/LAYER2/PROTO_AGENT/proto_agent.c +++ b/openair2/LAYER2/PROTO_AGENT/proto_agent.c @@ -137,7 +137,11 @@ error: void proto_agent_stop(mod_id_t mod_id) { + if (!proto_agent[mod_id].channel) return; + proto_agent_async_release(proto_agent[mod_id].channel); proto_agent_destroy_channel(proto_agent[mod_id].channel->channel_id); + free(proto_agent[mod_id].channel); + proto_agent[mod_id].channel = NULL; } //void -- 2.26.2