void CUPnPImplMiniLib::StartDiscovery(uint16 nTCPPort, uint16 nUDPPort, uint16 nTCPWebPort){ DebugLog(_T("Using MiniUPnPLib based implementation")); DebugLog(_T("miniupnpc (c) 2006-2008 Thomas Bernard - http://miniupnp.free.fr/")); m_nOldUDPPort = (ArePortsForwarded() == TRIS_TRUE) ? m_nUDPPort : 0; m_nUDPPort = nUDPPort; m_nOldTCPPort = (ArePortsForwarded() == TRIS_TRUE) ? m_nTCPPort : 0; m_nTCPPort = nTCPPort; m_nOldTCPWebPort = (ArePortsForwarded() == TRIS_TRUE) ? m_nTCPWebPort : 0; m_nTCPWebPort = nTCPWebPort; m_bUPnPPortsForwarded = TRIS_UNKNOWN; m_bCheckAndRefresh = false; if (m_pURLs != NULL) FreeUPNPUrls(m_pURLs); delete m_pURLs; m_pURLs = NULL; delete m_pIGDData; m_pIGDData = NULL; if (m_bAbortDiscovery) return; CStartDiscoveryThread* pStartDiscoveryThread = (CStartDiscoveryThread*) AfxBeginThread(RUNTIME_CLASS(CStartDiscoveryThread), THREAD_PRIORITY_NORMAL,0, CREATE_SUSPENDED); m_hThreadHandle = pStartDiscoveryThread->m_hThread; pStartDiscoveryThread->SetValues(this); pStartDiscoveryThread->ResumeThread(); }
void CUPnPImplMiniLib::DeletePorts() { m_nOldUDPPort = (ArePortsForwarded() == TRIS_TRUE) ? m_nUDPPort : 0; m_nUDPPort = 0; m_nOldTCPPort = (ArePortsForwarded() == TRIS_TRUE) ? m_nTCPPort : 0; m_nTCPPort = 0; m_bUPnPPortsForwarded = TRIS_FALSE; DeletePorts(false); }