Destroy session when there's no response from peer by CloseSesssion 91/92091/1
authorYu Jiung <jiung.yu@samsung.com>
Thu, 13 Oct 2016 07:52:34 +0000 (16:52 +0900)
committerYu Jiung <jiung.yu@samsung.com>
Thu, 13 Oct 2016 07:56:14 +0000 (16:56 +0900)
Change-Id: I8d137ac1a9b1609cbb1f24ce2144e4818445acca
Signed-off-by: Yu jiung <jiung.yu@samsung.com>
packaging/asp-manager.spec
src/session/asp-session.c

index 36f9579..330a1cb 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       asp-manager
 Summary:    ASP(application service platform) manager
-Version:    0.0.11
+Version:    0.0.12
 Release:    2
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
index 35b1949..7371d07 100644 (file)
@@ -467,6 +467,8 @@ static gfsm_state_id_t _state_remove_session_sent_reaction_ack_received(
        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
@@ -1022,6 +1024,12 @@ void asp_session_peer_destroyed(guint8 *session_mac, guint32 session_id)
 
        /*_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));
 }
@@ -1895,6 +1903,8 @@ void _asp_session_fsm_init()
                          _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);
@@ -2782,3 +2792,14 @@ gfsm_state_id_t _state_remove_session_sent_reaction_nack_received(
 
        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;
+}