pAdapter->AddRef();\r
m_pAdapter = pAdapter;\r
m_pWvConnEp = NULL;\r
+ m_Connects = 0;\r
}\r
\r
STDMETHODIMP CNDConnector::\r
Init(void)\r
{\r
+ IWVConnectEndpoint *ep;\r
HRESULT hr;\r
\r
- hr = m_pAdapter->m_pWvProvider->CreateConnectEndpoint(&m_pWvConnEp);\r
- return NDConvertWVStatus(hr);\r
+ hr = m_pAdapter->m_pWvProvider->CreateConnectEndpoint(&ep);\r
+ if (FAILED(hr)) {\r
+ return NDConvertWVStatus(hr);\r
+ }\r
+\r
+ if (m_pWvConnEp != NULL) {\r
+ m_pWvConnEp->Release();\r
+ m_pWvConnEp = ep;\r
+ }\r
+\r
+ return ND_SUCCESS;\r
}\r
\r
CNDConnector::~CNDConnector()\r
IBAT_PATH_BLOB path;\r
HRESULT hr;\r
\r
+ if (m_Connects++ > 0) {\r
+ hr = Init();\r
+ if (FAILED(hr)) {\r
+ goto out;\r
+ }\r
+ }\r
+\r
RtlCopyMemory(&addr, &m_pAdapter->m_Address, AddressLength);\r
if (addr.Sa.sa_family == AF_INET) {\r
addr.Sin.sin_port = LocalPort;\r