Addind the mechanisms to cleanup eNB when SCTP connection is terminated.

master
Pedro Alvarez 7 years ago
parent b9aff650a7
commit bc447a32fe

@ -136,11 +136,24 @@ mme::run_thread()
m_s1ap_log.debug("Socket timeout reached"); m_s1ap_log.debug("Socket timeout reached");
} }
else{ else{
if(msg_flags & MSG_NOTIFICATION)
{
//Received notification
m_s1ap_log.console("SCTP Notification %d\n", ((union sctp_notification*)pdu->msg)->sn_header.sn_type);
if (((union sctp_notification*)pdu->msg)->sn_header.sn_type == SCTP_SHUTDOWN_EVENT)
{
m_s1ap_log.console("SCTP Association Gracefully Shutdown\n");
}
}
else
{
//Received data
pdu->N_bytes = rd_sz; pdu->N_bytes = rd_sz;
m_s1ap_log.info("Received S1AP msg. Size: %d\n", pdu->N_bytes); m_s1ap_log.info("Received S1AP msg. Size: %d\n", pdu->N_bytes);
m_s1ap.handle_s1ap_rx_pdu(pdu,&sri); m_s1ap.handle_s1ap_rx_pdu(pdu,&sri);
} }
} }
}
return; return;
} }

@ -62,7 +62,7 @@ s1ap::stop()
std::map<uint16_t,enb_ctx_t*>::iterator it = m_active_enbs.begin(); std::map<uint16_t,enb_ctx_t*>::iterator it = m_active_enbs.begin();
while(it!=m_active_enbs.end()) while(it!=m_active_enbs.end())
{ {
//print_enb_ctx_info(*it->second); print_enb_ctx_info(*it->second);
delete it->second; delete it->second;
m_active_enbs.erase(it++); m_active_enbs.erase(it++);
} }
@ -91,8 +91,10 @@ s1ap::enb_listen()
} }
//Sets the data_io_event to be able to use sendrecv_info //Sets the data_io_event to be able to use sendrecv_info
//Subscribes to the SCTP_SHUTDOWN event, to handle graceful shutdown
bzero (&evnts, sizeof (evnts)) ; bzero (&evnts, sizeof (evnts)) ;
evnts.sctp_data_io_event = 1; evnts.sctp_data_io_event = 1;
evnts.sctp_shutdown_event=1;
if(setsockopt(sock_fd, IPPROTO_SCTP, SCTP_EVENTS, &evnts, sizeof (evnts))){ if(setsockopt(sock_fd, IPPROTO_SCTP, SCTP_EVENTS, &evnts, sizeof (evnts))){
m_s1ap_log->console("Subscribing to sctp_data_io_events failed\n"); m_s1ap_log->console("Subscribing to sctp_data_io_events failed\n");
return -1; return -1;

Loading…
Cancel
Save