Example #1
0
void CTraderApi::Disconnect()
{
	// 如果队列中有请求包,在后面又进行了Release,又回过头来发送,可能导致当了
	StopThread();

	if(m_pApi)
	{
		m_pApi->RegisterSpi(nullptr);
		m_pApi->Release();
		m_pApi = nullptr;

		XRespone(ResponeType::OnConnectionStatus, m_msgQueue, this, ConnectionStatus::Disconnected, 0, nullptr, 0, nullptr, 0, nullptr, 0);
	}

	m_lRequestID = 0;//由于线程已经停止,没有必要用原子操作了

	ReleaseRequestListBuf();
	ReleaseRequestMapBuf();
}
Example #2
0
void CTraderApi::Disconnect()
{
    m_status = E_unconnected;
    if(m_pApi)
    {
        m_pApi->RegisterSpi(NULL);
        m_pApi->Release();
        m_pApi = NULL;

        if(m_msgQueue)
            m_msgQueue->Input_OnDisconnect(this,NULL,m_status);
    }

    StopThread();

    m_lRequestID = 0;//由于线程已经停止,没有必要用原子操作了

    ReleaseRequestListBuf();
    ReleaseRequestMapBuf();
}