void athenaTransportLinkAdapter_Destroy(AthenaTransportLinkAdapter **athenaTransportLinkAdapter) { // release listener instances if ((*athenaTransportLinkAdapter)->listenerList) { for (int index = 0; index < parcArrayList_Size((*athenaTransportLinkAdapter)->listenerList); index++) { AthenaTransportLink *athenaTransportLink = parcArrayList_Get((*athenaTransportLinkAdapter)->listenerList, index); athenaTransportLink_Close(athenaTransportLink); } } // release live instances if ((*athenaTransportLinkAdapter)->instanceList) { for (int index = 0; index < parcArrayList_Size((*athenaTransportLinkAdapter)->instanceList); index++) { AthenaTransportLink *athenaTransportLink = parcArrayList_Get((*athenaTransportLinkAdapter)->instanceList, index); if (athenaTransportLink) { athenaTransportLink_Close(athenaTransportLink); } } } parcArrayList_Destroy(&((*athenaTransportLinkAdapter)->moduleList)); parcArrayList_Destroy(&((*athenaTransportLinkAdapter)->instanceList)); parcArrayList_Destroy(&((*athenaTransportLinkAdapter)->listenerList)); if ((*athenaTransportLinkAdapter)->pollfdReceiveList) { parcMemory_Deallocate(&((*athenaTransportLinkAdapter)->pollfdReceiveList)); parcMemory_Deallocate(&((*athenaTransportLinkAdapter)->pollfdSendList)); parcMemory_Deallocate(&((*athenaTransportLinkAdapter)->pollfdTransportLink)); } parcLog_Release(&((*athenaTransportLinkAdapter)->log)); parcMemory_Deallocate(athenaTransportLinkAdapter); }
static void _athenaEthernet_Destroy(AthenaEthernet **athenaEthernet) { parcLog_Release(&((*athenaEthernet)->log)); close((*athenaEthernet)->fd); if ((*athenaEthernet)->bpfBuffer) { parcBuffer_Release(&((*athenaEthernet)->bpfBuffer)); } }
static void _athenaDestroy(Athena **athena) { ccnxName_Release(&((*athena)->athenaName)); athenaTransportLinkAdapter_Destroy(&((*athena)->athenaTransportLinkAdapter)); athenaContentStore_Release(&((*athena)->athenaContentStore)); athenaPIT_Release(&((*athena)->athenaPIT)); athenaFIB_Release(&((*athena)->athenaFIB)); parcLog_Release(&((*athena)->log)); }
static void _ccnxPortalRTAContext_Destroy(_CCNxPortalRTAContext **instancePtr) { _CCNxPortalRTAContext *instance = *instancePtr; rtaTransport_Close(instance->rtaTransport, instance->fileId); rtaTransport_Destroy(&instance->rtaTransport); ccnxTransportConfig_Destroy((CCNxTransportConfig **) &instance->configuration); parcLog_Release(&instance->logger); }
void athenaTransportLinkModule_Destroy(AthenaTransportLinkModule **athenaTransportLinkModule) { int index = (int) parcArrayList_Size((*athenaTransportLinkModule)->instanceList); while (index-- > 0) { AthenaTransportLink *transportLink; transportLink = parcArrayList_Get((*athenaTransportLinkModule)->instanceList, 0); athenaTransportLink_Close(transportLink); } parcArrayList_Destroy(&((*athenaTransportLinkModule)->instanceList)); parcMemory_Deallocate(&((*athenaTransportLinkModule)->name)); parcLog_Release(&((*athenaTransportLinkModule)->log)); parcMemory_Deallocate(athenaTransportLinkModule); }
LONGBOW_TEST_CASE(CreateDestroy, parcLog_Create) { PARCFileOutputStream *fileOutput = parcFileOutputStream_Create(dup(STDOUT_FILENO)); PARCOutputStream *output = parcFileOutputStream_AsOutputStream(fileOutput); parcFileOutputStream_Release(&fileOutput); PARCLogReporter *reporter = parcLogReporterFile_Create(output); parcOutputStream_Release(&output); PARCLog *log = parcLog_Create("localhost", "test_parc_Log", NULL, reporter); parcLogReporter_Release(&reporter); assertTrue(parcLogLevel_Equals(parcLog_GetLevel(log), PARCLogLevel_Off), "Expected initial log level to be OFF"); parcLog_Release(&log); }
static void _destroy_link(AthenaTransportLink **athenaTransportLink) { parcMemory_Deallocate(&((*athenaTransportLink)->linkName)); parcLog_Release(&((*athenaTransportLink)->log)); }