コード例 #1
0
ファイル: client.c プロジェクト: hakanernam/legato-af
//--------------------------------------------------------------------------------------------------
void StopClient
(
    void
)
{
    _ClientThreadData_t* clientThreadPtr = pthread_getspecific(_ThreadDataKey);

    // If the thread specific data is NULL, then there is no current client session.
    if (clientThreadPtr == NULL)
    {
        LE_ERROR("Trying to stop non-existent client session for '%s' service",
                 GlobalServiceInstanceName);
    }
    else
    {
        le_msg_CloseSession( clientThreadPtr->sessionRef );

        // Need to delete the thread specific data, since it is no longer valid.  If a new
        // client session is started, new thread specific data will be allocated.
        le_mem_Release(clientThreadPtr);
        if (pthread_setspecific(_ThreadDataKey, NULL) != 0)
        {
            LE_FATAL("pthread_setspecific() failed!");
        }

        LE_DEBUG("======= Stopping Client %s ========", GlobalServiceInstanceName);
    }
}
コード例 #2
0
ファイル: treeUser.c プロジェクト: andreasanna/legato-af
//--------------------------------------------------------------------------------------------------
void tu_TerminateConfigAdminClient
(
    le_msg_SessionRef_t sessionRef,  ///< [IN] The session that needs to close.
    const char* killMessage          ///< [IN] The reason the session needs to close.
)
//--------------------------------------------------------------------------------------------------
{
    tu_UserRef_t userRef = GetUserInfo(sessionRef, NULL);

    LE_EMERG("A fatal error occured.  Killing admin sesssion <%p> for user %s, <%u>.  Reason: %s",
             sessionRef,
             tu_GetUserName(userRef),
             tu_GetUserId(userRef),
             killMessage);

    le_msg_CloseSession(sessionRef);
}