CAResult_t CAAdapterStopQueue() { OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "IN"); //Stop send queue thread CAQueueingThreadStop(g_sendQueueHandle); //Stop receive queue thread CAQueueingThreadStop(g_recvQueueHandle); OIC_LOG(DEBUG, EDR_ADAPTER_TAG, "OUT"); return CA_STATUS_OK; }
CAResult_t CAStopIP() { OIC_LOG(DEBUG, TAG, "IN"); #ifdef __WITH_DTLS__ CAAdapterNetDtlsDeInit(); #endif #ifndef SINGLE_THREAD if (g_sendQueueHandle && g_sendQueueHandle->threadMutex) { CAQueueingThreadStop(g_sendQueueHandle); } CAIPDeinitializeQueueHandles(); #endif CAIPStopNetworkMonitor(); CAIPStopServer(); //Re-initializing the Globals to start them again CAInitializeIPGlobals(); OIC_LOG(DEBUG, TAG, "OUT"); return CA_STATUS_OK; }
CAResult_t CAStopTCP() { if (g_sendQueueHandle && g_sendQueueHandle->threadMutex) { CAQueueingThreadStop(g_sendQueueHandle); } CATCPDeinitializeQueueHandles(); CATCPStopServer(); //Re-initializing the Globals to start them again CAInitializeTCPGlobals(); return CA_STATUS_OK; }
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 }