Mtce: Stop calling 'event_base_loopbreak' for nonblocking http requests

The SM API event handler is calling event_base_loopbreak for all requests.
This is sometimes causing segfault when this is done in the http handler
for non-blocking requests.

This update prevents this call for non-blocking requests.

Change-Id: Ib083100ccd74aa984bd86921c7521bfec925e779
Signed-off-by: Eric MacDonald <eric.macdonald@windriver.com>
This commit is contained in:
Eric MacDonald 2018-05-28 19:35:10 -04:00
parent 09a6a36c36
commit 0328da92d2
3 changed files with 13 additions and 6 deletions

View File

@ -1000,6 +1000,11 @@ int mtcHttpUtil_receive ( libEvent & event )
break ;
}
}
if ( rc != RETRY )
{
mtcHttpUtil_free_conn ( event );
mtcHttpUtil_free_base ( event );
}
return (rc);
}

View File

@ -3648,7 +3648,6 @@ int nodeLinkClass::swact_handler ( struct nodeLinkClass::node * node_ptr )
* the task and setting it back to the start. */
if ( node_ptr->mtcSwact_timer.ring == true )
{
mtcHttpUtil_free_conn ( nodeLinkClass::smgrEvent );
mtcInvApi_force_task ( node_ptr, "");
nodeLinkClass::smgrEvent.active = false ;
nodeLinkClass::smgrEvent.mutex = false ;

View File

@ -58,13 +58,16 @@ void nodeLinkClass::mtcSmgrApi_handler ( struct evhttp_request *req, void *arg )
mtcSmgrApi_handler_out:
mtcHttpUtil_free_conn ( smgrEvent );
mtcHttpUtil_free_base ( smgrEvent );
if ( smgrEvent.blocking == true )
{
mtcHttpUtil_free_conn ( smgrEvent );
mtcHttpUtil_free_base ( smgrEvent );
/* This is needed to get out of the loop in the blocking case
* Calling this here in non-blocking calls can lead to segfault */
event_base_loopbreak((struct event_base *)arg);
}
smgrEvent.active = false ;
/* This is needed to get out of the loop */
event_base_loopbreak((struct event_base *)arg);
}
/*