void *p_context_data, void *p_event_data);
static gfsm_state_id_t _state_remove_session_sent_reaction_nack_received(
void *p_context_data, void *p_event_data);
+static gfsm_state_id_t _state_remove_session_sent_reaction_peer_destroyed(
+ void *p_context_data, void *p_event_data);
/*****************************************************************************
* API Definition
/*_remove_session(session_mac, session_id); */
asp_session_s *session = _get_exist_session(session_id, session_mac);
+
+ if (session == NULL) {
+ ASP_LOGE("session [%u] already destroyed", session_id);
+ return;
+ }
+
gfsm_process_event(session->context,
gfsm_create_event(SESSION_EVENT_PEER_DESTROYED, NULL, NULL));
}
_state_remove_session_sent_reaction_ack_received);
gfsm_add_reaction(session_state_remove_session_sent,
SESSION_EVENT_NACK_RECEIVED, _state_remove_session_sent_reaction_nack_received);
+ gfsm_add_reaction(session_state_remove_session_sent, SESSION_EVENT_PEER_DESTROYED,
+ _state_remove_session_sent_reaction_peer_destroyed);
gfsm_add_state(session_fsm, session_state_none);
gfsm_add_state(session_fsm, session_state_closed);
return SESSION_STATE_CLOSED;
}
+
+static gfsm_state_id_t _state_remove_session_sent_reaction_peer_destroyed(
+ void *p_context_data, void *p_event_data)
+{
+ INFO_MSG;
+
+ asp_session_s *session = (asp_session_s *)p_context_data;
+ session->closed_state = ASP_SESSION_CLOSED_STATE_LOCAL_CLOSE;
+
+ return SESSION_STATE_CLOSED;
+}