Example #1
0
int32_t exitClassd()
{
    pthread_mutex_lock(&classdMutex);

    if ( classdInited == FALSE ){
        pthread_mutex_unlock(&classdMutex);
        return RESULT_FAILURE;
    }

    if( classdMode == MODE_CLIENT )
    {
        pClientEndpoint->Disconnect();
        ClassD::EndpointFactory::DeleteEndpoint(pClientEndpoint->GetLinkAttributes().GetLinkId());
    }
    else
    {
        pServerEndpoint->Stop();
        ClassD::EndpointFactory::DeleteEndpoint(pServerEndpoint->GetLinkAttributes().GetLinkId());
    }
    ClassD::EndpointFactory::DeleteAllEndpoints();

    classdInited = FALSE;
    classdConnectionState = FALSE;

    pthread_mutex_unlock(&classdMutex);
    return 0;
}