void CATerminateMessageHandler() { OIC_LOG(DEBUG, TAG, "IN"); // terminate interface adapters by controller CATerminateAdapters(); // stop retransmission CARetransmissionStop(&g_retransmissionContext); CARetransmissionDestroy(&g_retransmissionContext); OIC_LOG(DEBUG, TAG, "OUT"); }
void CATerminateMessageHandler() { #ifndef SINGLE_THREAD CATransportAdapter_t connType; u_arraylist_t *list = CAGetSelectedNetworkList(); uint32_t length = u_arraylist_length(list); uint32_t i = 0; for (i = 0; i < length; i++) { void* ptrType = u_arraylist_get(list, i); if (NULL == ptrType) { continue; } connType = *(CATransportAdapter_t *)ptrType; CAStopAdapter(connType); } // stop retransmission if (NULL != g_retransmissionContext.threadMutex) { CARetransmissionStop(&g_retransmissionContext); } // stop thread // delete thread data if (NULL != g_sendThread.threadMutex) { CAQueueingThreadStop(&g_sendThread); } // stop thread // delete thread data if (NULL != g_receiveThread.threadMutex) { #ifndef SINGLE_HANDLE // This will be enabled when RI supports multi threading CAQueueingThreadStop(&g_receiveThread); #endif /* SINGLE_HANDLE */ } // destroy thread pool if (NULL != g_threadPoolHandle) { ca_thread_pool_free(g_threadPoolHandle); g_threadPoolHandle = NULL; } #ifdef WITH_BWT CATerminateBlockWiseTransfer(); #endif CARetransmissionDestroy(&g_retransmissionContext); CAQueueingThreadDestroy(&g_sendThread); CAQueueingThreadDestroy(&g_receiveThread); // terminate interface adapters by controller CATerminateAdapters(); #else // terminate interface adapters by controller CATerminateAdapters(); // stop retransmission CARetransmissionStop(&g_retransmissionContext); CARetransmissionDestroy(&g_retransmissionContext); #endif }