From ec9e70a023de89b1707ec0e78e16298c86a26a15 Mon Sep 17 00:00:00 2001 From: Robert Schmidt <robert.schmidt@eurecom.fr> Date: Fri, 26 Oct 2018 11:20:51 +0200 Subject: [PATCH] FlexRAN: provide better error messages in async channel --- openair2/ENB_APP/flexran_agent.c | 9 ++++++++- openair2/ENB_APP/flexran_agent_async.c | 24 +++++++++++++++++------- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/openair2/ENB_APP/flexran_agent.c b/openair2/ENB_APP/flexran_agent.c index c2a1790380..79cb6ea97f 100644 --- a/openair2/ENB_APP/flexran_agent.c +++ b/openair2/ENB_APP/flexran_agent.c @@ -201,6 +201,11 @@ int flexran_agent_start(mid_t mod_id) /*Create the async channel info*/ flexran_agent_async_channel_t *channel_info = flexran_agent_async_channel_info(mod_id, in_ip, in_port); + if (!channel_info) { + LOG_E(FLEXRAN_AGENT, "could not create channel_info\n"); + exit(1); + } + /*Create a channel using the async channel info*/ channel_id = flexran_agent_create_channel((void *) channel_info, flexran_agent_async_msg_send, @@ -209,12 +214,14 @@ int flexran_agent_start(mid_t mod_id) if (channel_id <= 0) { + LOG_E(FLEXRAN_AGENT, "could not create channel\n"); goto error; } flexran_agent_channel_t *channel = get_channel(channel_id); if (channel == NULL) { + LOG_E(FLEXRAN_AGENT, "could not get channel for channel_id %d\n", channel_id); goto error; } @@ -307,7 +314,7 @@ int flexran_agent_start(mid_t mod_id) return 0; error: - LOG_I(FLEXRAN_AGENT,"there was an error\n"); + LOG_E(FLEXRAN_AGENT, "%s(): there was an error\n", __func__); return 1; } diff --git a/openair2/ENB_APP/flexran_agent_async.c b/openair2/ENB_APP/flexran_agent_async.c index d738f981f9..12d9bf7e2a 100644 --- a/openair2/ENB_APP/flexran_agent_async.c +++ b/openair2/ENB_APP/flexran_agent_async.c @@ -36,13 +36,18 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c flexran_agent_async_channel_t *channel; channel = (flexran_agent_async_channel_t *) malloc(sizeof(flexran_agent_channel_t)); - if (channel == NULL) - goto error; + if (channel == NULL) { + LOG_E(FLEXRAN_AGENT, "could not allocate memory for flexran_agent_async_channel_t\n"); + return NULL; + } channel->enb_id = mod_id; /*Create a socket*/ channel->link = new_link_client(dst_ip, dst_port); - if (channel->link == NULL) goto error; + if (channel->link == NULL) { + LOG_E(FLEXRAN_AGENT, "could not create new link client\n"); + goto error; + } LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n", channel->enb_id, @@ -56,12 +61,17 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c // channel->send_queue = new_message_queue(500); // not using the circular buffer: affects the PDCP split channel->send_queue = new_message_queue(); - - if (channel->send_queue == NULL) goto error; + if (channel->send_queue == NULL) { + LOG_E(FLEXRAN_AGENT, "could not create send_queue\n"); + goto error; + } // not using the circular buffer: affects the PDCP split //channel->receive_queue = new_message_queue(500); channel->send_queue = new_message_queue(); - if (channel->receive_queue == NULL) goto error; + if (channel->receive_queue == NULL) { + LOG_E(FLEXRAN_AGENT, "could not create send_queue\n"); + goto error; + } /* * create a link manager @@ -81,7 +91,7 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c return channel; error: - LOG_I(FLEXRAN_AGENT,"there was an error\n"); + LOG_I(FLEXRAN_AGENT, "%s(): there was an error\n", __func__); return NULL; } -- GitLab