diff --git a/openair2/F1AP/f1ap_cu_task.c b/openair2/F1AP/f1ap_cu_task.c index e63136222611eb15bc717f2ce4046e248805b539..dc482e70618be93d571a96e0562ae52b0d81a640 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 0b53f366bc3349c9b242c7ac9fe026f9a2b0b201..00441aeed572ffef88836c55a0aa2265c864e352 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