Commit ec9e70a0 authored by Robert Schmidt's avatar Robert Schmidt

FlexRAN: provide better error messages in async channel

parent d7948d04
...@@ -201,6 +201,11 @@ int flexran_agent_start(mid_t mod_id) ...@@ -201,6 +201,11 @@ int flexran_agent_start(mid_t mod_id)
/*Create the async channel info*/ /*Create the async channel info*/
flexran_agent_async_channel_t *channel_info = flexran_agent_async_channel_info(mod_id, in_ip, in_port); 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*/ /*Create a channel using the async channel info*/
channel_id = flexran_agent_create_channel((void *) channel_info, channel_id = flexran_agent_create_channel((void *) channel_info,
flexran_agent_async_msg_send, flexran_agent_async_msg_send,
...@@ -209,12 +214,14 @@ int flexran_agent_start(mid_t mod_id) ...@@ -209,12 +214,14 @@ int flexran_agent_start(mid_t mod_id)
if (channel_id <= 0) { if (channel_id <= 0) {
LOG_E(FLEXRAN_AGENT, "could not create channel\n");
goto error; goto error;
} }
flexran_agent_channel_t *channel = get_channel(channel_id); flexran_agent_channel_t *channel = get_channel(channel_id);
if (channel == NULL) { if (channel == NULL) {
LOG_E(FLEXRAN_AGENT, "could not get channel for channel_id %d\n", channel_id);
goto error; goto error;
} }
...@@ -307,7 +314,7 @@ int flexran_agent_start(mid_t mod_id) ...@@ -307,7 +314,7 @@ int flexran_agent_start(mid_t mod_id)
return 0; return 0;
error: error:
LOG_I(FLEXRAN_AGENT,"there was an error\n"); LOG_E(FLEXRAN_AGENT, "%s(): there was an error\n", __func__);
return 1; return 1;
} }
......
...@@ -36,13 +36,18 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, 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; flexran_agent_async_channel_t *channel;
channel = (flexran_agent_async_channel_t *) malloc(sizeof(flexran_agent_channel_t)); channel = (flexran_agent_async_channel_t *) malloc(sizeof(flexran_agent_channel_t));
if (channel == NULL) if (channel == NULL) {
goto error; LOG_E(FLEXRAN_AGENT, "could not allocate memory for flexran_agent_async_channel_t\n");
return NULL;
}
channel->enb_id = mod_id; channel->enb_id = mod_id;
/*Create a socket*/ /*Create a socket*/
channel->link = new_link_client(dst_ip, dst_port); 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", LOG_I(FLEXRAN_AGENT,"starting enb agent client for module id %d on ipv4 %s, port %d\n",
channel->enb_id, channel->enb_id,
...@@ -56,12 +61,17 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c ...@@ -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); // channel->send_queue = new_message_queue(500);
// not using the circular buffer: affects the PDCP split // not using the circular buffer: affects the PDCP split
channel->send_queue = new_message_queue(); channel->send_queue = new_message_queue();
if (channel->send_queue == NULL) {
if (channel->send_queue == NULL) goto error; LOG_E(FLEXRAN_AGENT, "could not create send_queue\n");
goto error;
}
// not using the circular buffer: affects the PDCP split // not using the circular buffer: affects the PDCP split
//channel->receive_queue = new_message_queue(500); //channel->receive_queue = new_message_queue(500);
channel->send_queue = new_message_queue(); 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 * create a link manager
...@@ -81,7 +91,7 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c ...@@ -81,7 +91,7 @@ flexran_agent_async_channel_t * flexran_agent_async_channel_info(mid_t mod_id, c
return channel; return channel;
error: error:
LOG_I(FLEXRAN_AGENT,"there was an error\n"); LOG_I(FLEXRAN_AGENT, "%s(): there was an error\n", __func__);
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment