예제 #1
0
HX_RESULT HXCloakedV2TCPSocket::GetAddrInfoDone(HX_RESULT status,
                                                UINT32 nVecLen,
                                                IHXSockAddr** ppAddrVec)
{
    HX_RESULT res = HXR_FAIL;

    HX_ASSERT(0!=m_nProxyPort);

    //We are done getting the addr info for the proxy host.
    if( SUCCEEDED(status) && 1<=nVecLen )
    {
        HX_ASSERT(!m_pProxyAddr);
        HX_ASSERT(m_pTCPSocket);
        HX_RELEASE(m_pProxyAddr);
        ppAddrVec[0]->Clone(&m_pProxyAddr);
        m_pProxyAddr->SetPort(m_nProxyPort);
        if( m_pTCPSocket )
        {
            res = m_pTCPSocket->ConnectToOne(m_pProxyAddr);
        }
    }

    if( !SUCCEEDED(res) )
    {
        HX_RELEASE(m_pProxyAddr);
    }

    //hardcoded because I have no idea what the IHXSocket would do
    //with any other return code. Not sure why we return one at all.
    return HXR_OK;
}
예제 #2
0
STDMETHODIMP HXCloakedV2TCPSocket::Write(IHXBuffer* pBuffer)
{
    IHXBuffer* pNew      = NULL;
    HX_RESULT  res       = HXR_FAIL;
    CHXString  GetString = "";
    
    
//    HX_ASSERT( csReady == m_CloakingState && pBuffer );

//    if( csReady == m_CloakingState && pBuffer )
    if( pBuffer )
    {
        pBuffer->AddRef();
        res = _GeneratePostRequest(pBuffer, pNew);
        HX_ASSERT(SUCCEEDED(res));
        if( SUCCEEDED(res) && pNew )
        {
            res = m_pTCPSocket->Write(pNew);
        }
        
        HX_RELEASE(pBuffer);
        HX_RELEASE(pNew);

        //We always follow our POST request with a Get request.
        GetString = _GenerateGetRequest();
        _WriteString(GetString);
    }
    
    return res;
}
예제 #3
0
void OutputBuffers(UINT16 ulStreamID, IHXValues* pHdr)
{
    const char* pName = 0;
    IHXBuffer* pValue = 0;
    HX_RESULT res = pHdr->GetFirstPropertyBuffer(pName, pValue);
    
    while (HXR_OK == res)
    {
	printf("GetBuffer %u \"%s\" \"", ulStreamID, pName);

	UCHAR* pCur = pValue->GetBuffer();
	UCHAR* pEnd = pCur + pValue->GetSize();

	static const char z_hexChars[] = "0123456789abcdef";

	for (;pCur < pEnd; pCur++)
	{
	    printf("%c%c", z_hexChars[*pCur >> 4], z_hexChars[*pCur & 0xf]);
	}

	printf("\"\n");
	
	HX_RELEASE(pValue);
	
	res = pHdr->GetNextPropertyBuffer(pName, pValue);
    }
    
    HX_RELEASE(pValue);
}
예제 #4
0
void CHXPrefList::SetPreferences(IUnknown* pContext)
{
    IHXPreferences* pPrefs = NULL;
    IHXCommonClassFactory* pCCF = NULL;

    if (pContext &&
        (HXR_OK == pContext->QueryInterface(IID_IHXPreferences,
                                            (void**)&pPrefs)) &&
        (HXR_OK == pContext->QueryInterface(IID_IHXCommonClassFactory,
                                            (void**)&pCCF)))
    {
        CHXSimpleList::Iterator itr = m_prefInfo.Begin();
        
        for(; itr != m_prefInfo.End(); ++itr)
        {
            CHXPrefInfo* pInfo = (CHXPrefInfo*)(*itr);
            
            IHXBuffer* pBuf = NULL;
            
            if ((HXR_OK == pCCF->CreateInstance(CLSID_IHXBuffer,
                                                (void**)&pBuf)) &&
                (HXR_OK == pBuf->Set((const unsigned char*)pInfo->Value(),
                                     strlen(pInfo->Value()))))
            {
                pPrefs->WritePref(pInfo->Key(), pBuf);
            }

            HX_RELEASE(pBuf);
        }
    }

    HX_RELEASE(pPrefs);
    HX_RELEASE(pCCF);
}
예제 #5
0
CSymbIHXDataFile::~CSymbIHXDataFile(void)
{
    Close();
    HX_RELEASE(m_pFileName);
    HX_RELEASE(m_pSessionManager);
    HX_RELEASE(m_pContext);
}
예제 #6
0
int DLLAccessClient::open(const char* dllName, 
			  UINT16 nLibType, 
			  IUnknown* pContext)
{
    HX_RESULT status;
    int retVal = DLLAccess::NO_LOAD;
    IHXCommonClassFactory* pCCF = NULL;

    HX_RELEASE(m_pDllAccessServer);

    status = pContext->QueryInterface(IID_IHXCommonClassFactory,
				      (void**) &pCCF);
    if (SUCCEEDED(status))
    {
	pCCF->CreateInstance(CLSID_IHXDllAccess,
			     (void**) &m_pDllAccessServer);
    }

    HX_RELEASE(pCCF);

    if (m_pDllAccessServer)
    {
	if (SUCCEEDED(m_pDllAccessServer->Open(dllName, nLibType)))
	{
	    retVal = DLLAccess::DLL_OK;
	}
    }
    
    return retVal;
}
예제 #7
0
CAudioOutOpenwave::~CAudioOutOpenwave()
{
    //We must assume that _Imp_Close has already been called. If not, we are 
    //in big trouble.
    if ( m_wState != RA_AOS_CLOSED ) 
    {
        HX_ASSERT( "Device not closed in dtor." == NULL );
    }

    //Clean up the scheduler.
    HX_RELEASE( m_pScheduler );
    HX_DELETE(m_pPlaybackCountCBTime);
    HX_RELEASE(m_pCallback);
    //OpDPRINTF("dtor: Freeing sample buffer, expect an exception\n");
    for (int i=0; i<10; i++)
    	HX_DELETE(m_SndBuf[i].fSampleBuffer);
    //OpDPRINTF("dtor: Done freeing sample buffers \n");
    if (m_pSndDev) 
    {
    	//OpDPRINTF("dtor : before freeing the channel\n");
	op_sound_unregister_callback(m_pSndDev, iodone_callback);
	op_sound_freechan(m_pSndDev);
    	//OpDPRINTF("dtor : freeing the channel\n");
    }
    HX_DELETE(m_pWriteList); // Remove all elements in the list, if any
}
예제 #8
0
HX_RESULT CMP4ADecoder::OpenNext(IHXValues* pHeader,
                                 IMP4APayloadFormat* pRssm, 
			         IHXAudioDecoder** pOutAudioDecoder,
			         IUnknown* pContext)
{
    HX_RESULT retVal = HXR_FAIL;

    if (pHeader && pOutAudioDecoder)
    {
        // Close the decoder
        Close();
        // Get the mime type
        IHXBuffer* pMimeType = NULL;
        pHeader->GetPropertyCString("MimeType", pMimeType);
        if (pMimeType)
        {
            m_pDecoderInfo = m_decInfoStore.GetInfoNext((const char*) pMimeType->GetBuffer(), pRssm);
            if (m_pDecoderInfo)
            {
                HX_RELEASE(*pOutAudioDecoder);
                retVal = BuildDLLAccessBridge(pOutAudioDecoder, pMimeType, pRssm, pContext);
            }
        }
        HX_RELEASE(pMimeType);
    }

    return retVal;
}
예제 #9
0
/*
 * ClientRegTree::RegTreeInit()
 *
 * This object is meant to be passed from client to client as the sequential
 * WMT HTTP requests come in.  Therefore, only one client at a time is 
 * accessing it (so no mutex needed), but we must ensure that this object has
 * the context and registry for the current proc.  Thus, it must be init'ed
 * every time a new client picks it up.
 */
HX_RESULT
ClientRegTree::RegTreeInit(Client* pClient, IHXBuffer* pStartTime)
{
    HX_RELEASE(m_pContext);
    HX_RELEASE(m_pRegistry);
    HX_RELEASE(m_pClassFactory);

    m_pProc = pClient->proc;        // don't addref/release
    m_pProc->pc->server_context->
        QueryInterface(IID_IUnknown, (void**) &m_pContext);

    m_pContext->QueryInterface(IID_IHXRegistry, (void**) &m_pRegistry);
    m_pContext->QueryInterface(IID_IHXCommonClassFactory,
                               (void**) &m_pClassFactory);

    // The seqnum (session id) is persistent across calls.
    // Only set up the registry tree once.

    if (!m_ulRegistryConnId)
    {
        m_ulRegistryConnId = m_pProc->pc->server_info->
            IncrementTotalClientCount(m_pProc);

        InitRegistry(pStartTime);
    }

    return HXR_OK;
}
예제 #10
0
	WebkitClientAdviseSink::~WebkitClientAdviseSink(void)
	{
		HX_RELEASE(m_pRegistry);
		HX_RELEASE(m_pPlayer);
		HX_RELEASE(m_pUnknown);
		HX_RELEASE(m_pWebkitContext);
	}
예제 #11
0
void
HXRecordControl::Cleanup()
{
    OnEndOfPackets();

    for(UINT16 nStream = 0; nStream < m_PendingGetPackets.GetSize(); nStream++)
    {
	IHXPacket* pPacket = (IHXPacket*)m_PendingGetPackets.GetAt(nStream);
	m_PendingGetPackets.SetAt(nStream, NULL);
	HX_RELEASE(pPacket);
    }

    if(m_pRecordService)
	m_pRecordService->CloseRecordSource(m_pRecordSource);

    HX_RELEASE(m_pRecordService);
    HX_RELEASE(m_pRecordSource);
    HX_VECTOR_DELETE(m_pStreamInfo);
#if defined(HELIX_FEATURE_RECORDCONTROL_MERGESORT)
    HX_DELETE(m_pMergeSorter);
#endif /* #if defined(HELIX_FEATURE_RECORDCONTROL_MERGESORT) */

    while(!m_PendingPutPackets.IsEmpty())
    {
	PendingPutPacket* pPutPacket = (PendingPutPacket*)m_PendingPutPackets.RemoveHead();
	HX_ASSERT(pPutPacket);
	HX_RELEASE(pPutPacket->pPacket);
	HX_DELETE(pPutPacket);
    }
}
예제 #12
0
STDMETHODIMP
StaticPushSource::Done()
{
    HX_VECTOR_DELETE(m_pStreams);
    HX_RELEASE(m_pSinkControl);
    HX_RELEASE(m_pFileObject);
    HX_RELEASE(m_pBWEValues);
    HX_RELEASE(m_pRequest);

    if (m_pSink)
    {
	m_pSink->SourceDone();
	m_pSink->Release();
	m_pSink = NULL;
    }

    if (m_pFileFormat)
    {
        /*
         * Close() must be called before Release() so that the
         * IHXFileFormatObject will properly free its IHXFileObject
         */

        m_pFileFormat->Close();
        m_pFileFormat->Release();
        m_pFileFormat = NULL;
    }

    return HXR_OK;
}
예제 #13
0
ConfigWatcher::~ConfigWatcher()
{
    Cleanup();
    HX_RELEASE(m_pRegistry);
    HX_RELEASE(m_pActiveRegistry);
    HX_RELEASE(m_pPropWatch);
}
예제 #14
0
HXFileSystemManager::~HXFileSystemManager()
{
    if (m_pContext)
    {
	m_pContext->Release();
	m_pContext = 0;
    }

    if(m_pSamePool)
    {
	m_pSamePool->Release();
	m_pSamePool = NULL;
    }

    if (m_pFSManagerResponse)
    {
	m_pFSManagerResponse->Release();
	m_pFSManagerResponse = 0;
    }

    HX_RELEASE(m_pRequest);

    if (m_pCallback &&
	m_pCallback->m_bIsCallbackPending &&
	m_pScheduler)
    {
	m_pScheduler->Remove(m_pCallback->m_Handle);
    }

    HX_RELEASE(m_pCallback);
    HX_RELEASE(m_pScheduler);
    HX_RELEASE(m_pOriginalObject);
    HX_VECTOR_DELETE(m_pRelativePath);
}
예제 #15
0
static /* private */
bool MatchClass(IHXSockAddr* pAddr, HXIN4AddrClass addrClassIN4, 
                HXIN6AddrClass addrClassIN6)
{
    HX_ASSERT(HX_IN6_CLASS_V4MAPPED != addrClassIN6);

    bool isMatch = false;
    HX_RESULT hxr = HXR_FAILED;
    
    IHXSockAddrIN6* pAddr6 = 0;
    hxr = pAddr->QueryInterface(IID_IHXSockAddrIN6, 
                    reinterpret_cast<void**>(&pAddr6));
    if(SUCCEEDED(hxr))
    {
        isMatch = MatchClassIN6(pAddr6, addrClassIN4, addrClassIN6);
        HX_RELEASE(pAddr6);
    }
    else
    {
        IHXSockAddrIN4* pAddr4 = 0;
        hxr = pAddr->QueryInterface(IID_IHXSockAddrIN4, 
                        reinterpret_cast<void**>(&pAddr4));
        if(SUCCEEDED(hxr))
        {
            isMatch = (addrClassIN4 == pAddr4->GetAddrClass());
            HX_RELEASE(pAddr4);
        }
    }
    return isMatch;
}
예제 #16
0
STDMETHODIMP
DataRevertController::RevertedFileHeaderReady(HX_RESULT status,
						IHXValues* pHeader)
{
    if (pHeader)
    {
	HX_RELEASE(m_pFileHeaders);
	m_pFileHeaders = pHeader;
	pHeader->AddRef();
    }

    pHeader = (IHXValues*)m_pStreamHeaders->RemoveHead(); 
    if (!pHeader)
    {
	m_pControlResp->RevertHeadersDone(m_pFileHeaders,
					  m_pRevertedStreamHeaders, 
					  m_pResponseHeaders,
					  TRUE);
	return HXR_OK;
    }
    
    HX_RELEASE(m_pCurrentStreamHeader);
    m_pCurrentStreamHeader = pHeader;
    m_pDataRevert->RevertStreamHeader(pHeader);

    return HXR_OK;
}
예제 #17
0
HXExternalResourceManager::~HXExternalResourceManager()
{
    delete[] m_pExternalResDir;

    if(m_pResourceList)
    {
	CHXSimpleList::Iterator i = m_pResourceList->Begin();
	for (; i != m_pResourceList->End(); ++i)
	{
	    IHXXResFile* pRes = (IHXXResFile*)(*i);
	    pRes->Close();
	    pRes->Release();
	}
    }

    HX_DELETE(m_pResourceList);
    HX_RELEASE(m_pPrefs);
    HX_RELEASE(m_pRegistry);
    HX_RELEASE(m_pContext);
    HX_RELEASE(m_pHXXResPlugin);

#if defined(HELIX_CONFIG_NOSTATICS)
    HXExternalResourceManager*& m_pResourceManager =
	(HXExternalResourceManager*&)HXGlobalPtr::Get(
	    &HXExternalResourceManager::m_pResourceManager);
#endif
    m_pResourceManager = NULL;
}
예제 #18
0
void
HXOverlayManager::Close()
{ 
    CSiteStats* pStats;
    CStatPoint* pPoint;

    while (m_ListOfSiteStats.GetCount())
    {
        pStats = (CSiteStats*) m_ListOfSiteStats.RemoveHead();
        while(pStats->samples.GetCount())
        {
            pPoint = (CStatPoint*) pStats->samples.RemoveHead();
            HX_DELETE(pPoint);
        }
        HX_DELETE(pStats);
    }

    if (m_CallbackHandle)
    {
        m_pScheduler->Remove(m_CallbackHandle);
        m_CallbackHandle = 0;
    }

    HX_RELEASE(m_pContext);
    HX_RELEASE(m_pScheduler);
    HX_RELEASE(m_pMutex);
}
예제 #19
0
HX_RESULT CHXAudioDeviceDS::InternalClose()
{
    HX_RESULT	theErr = HXR_OK;

    KillThreadAndEvent();

    HX_RELEASE(m_pAudioHookDMO);
    HX_RELEASE(m_pPrimaryBuffer);
    HX_RELEASE(m_pSecondaryBuffer);
    HX_RELEASE(m_pDSDev);
    m_pAudioPtrStart = NULL;
    m_ulLastPlayCursor = 0;
    m_ulLastWriteCursor =0;
    m_eState = E_DEV_CLOSED;
    m_ulLoops = 0;
    m_ulLoopTime = 0;
    m_nBlocksPerBuffer = 0;
    m_ulCurrPlayTime = 0;
	m_ulCurrLoopTime = 0;

    if (m_hwnd)
    {
	SetWindowLong(m_hwnd, GWL_USERDATA, NULL);
    }

    return HXR_OK;
}
예제 #20
0
HX_RESULT
FileFormatSource::Init(IHXPSinkControl* pSink)
{
    HX_RESULT			h_result = HXR_OK;
    IHXFileObject*             pFileObject;
    IHXBandwidthNegotiator*    pBandwidthNegotiator;

    HX_RELEASE(m_pSinkControl);
    pSink->AddRef();
    m_pSinkControl = pSink;

    AddRef();
    if (HXR_OK == h_result)
    {
        if(HXR_OK == m_pFileObject->QueryInterface(IID_IHXFileObject,
                                                 (void**)&pFileObject))
        {
          
            if(m_bwe_values && 
               (HXR_OK == m_file_format->QueryInterface(
                IID_IHXBandwidthNegotiator,
                (void**)&pBandwidthNegotiator)))
            {
                pBandwidthNegotiator->SetBandwidthInfo(m_bwe_values);
                pBandwidthNegotiator->Release();
                m_bwe_values->Release();
                m_bwe_values = NULL;
            }

            HX_ASSERT(m_file_format != NULL);
            if (m_bFileFormatInitialized)
            {
                InitDone(HXR_OK);
            }
            else
            {
                m_bFileFormatInitialized = TRUE;
                h_result = m_file_format->InitFileFormat(m_pRequest, this,
                                                     pFileObject);
            }

            HX_RELEASE(pFileObject);

            if (HXR_OK != h_result)
            {
                ERRMSG(m_proc->pc->error_handler,
                       "File Format initialization failed\n");
                m_file_format->Close();
                m_file_format->Release();
                m_file_format = 0;
                m_bFileFormatInitialized = FALSE;
            }
        }

    }

    Release();

    return h_result;
}
예제 #21
0
HX_RESULT
CHXAltGroupIterator::getIterator(IUnknown* pUnk)
{
    HX_RESULT res = HXR_INVALID_PARAMETER;

    if (pUnk)
    {
        IHXList* pList = NULL;
        res = pUnk->QueryInterface(IID_IHXList, (void**)&pList);

        if (HXR_OK == res)
        {
            HX_RELEASE(m_pItr);

            m_pItr = pList->Begin();

            if (!m_pItr)
            {
                res = HXR_UNEXPECTED;
            }
        }
        HX_RELEASE(pList);
    }

    return res;
}
예제 #22
0
HX_RESULT CBaseArchiver2::MakeNuggetFileObject(IHXFileObject* pFileObject,
					       const char* pFileMimeType,
					       IHXFileObject* &pNuggetFileObject)
{
    HX_RESULT retVal = HXR_OUTOFMEMORY;
    CNGTFileObject* pNewNuggetFileObject = new CNGTFileObject();

    if (pNewNuggetFileObject)
    {
	pNewNuggetFileObject->AddRef();
	retVal = pNewNuggetFileObject->InitNugget(m_pContext,
					          pFileObject,
						  HX_FILE_READ | HX_FILE_WRITE | HX_FILE_BINARY,
						  NULL,	    // IHXMetaFileFormatResponse
						  TRUE);    // bForceNew

	if (SUCCEEDED(retVal))
	{
	    UINT32 ulExpiration = 0;
	    UINT32 ulConnectTime = 0;
	    IHXBuffer* pRemoteSourceURLBuffer = NULL;

	    m_pAdviser->GetPropertyULONG32("NuggetExpiration", 
					   ulExpiration);

	    m_pAdviser->GetPropertyCString("NuggetRemoteSourceURL", 
					   pRemoteSourceURLBuffer);

	    m_pAdviser->GetPropertyULONG32("NuggetConnectTime", 
					   ulConnectTime);

	    retVal = pNewNuggetFileObject->ConfigureNugget(
			   ulExpiration,
			   ulConnectTime,
			   m_ulNuggetMinLocalDuration,
			   m_ulMaxDuration,
			   pFileMimeType,
			   pRemoteSourceURLBuffer ? ((const char*) pRemoteSourceURLBuffer->GetBuffer()) : NULL);

	    HX_RELEASE(pRemoteSourceURLBuffer);
	}

	if (SUCCEEDED(retVal))
	{
	    retVal = pNewNuggetFileObject->QueryInterface(IID_IHXFileObject, 
							  (void**) &pNuggetFileObject);
	}

	if (SUCCEEDED(retVal))
	{
	    m_pNuggetFileObject = pNewNuggetFileObject;
	    HX_ADDREF(m_pNuggetFileObject);
	}
    }

    HX_RELEASE(pNewNuggetFileObject);

    return retVal;
}
예제 #23
0
void
BasicPacketFlow::ScheduleStreamDone(BasicPacketFlow* pFlow,
                                    Transport* pTransport, 
                                    PacketStream* pStream, 
                                    UINT16 unStreamNumber)
{
    /* 
     * Notify the protocol if we've reached the end of the stream following a
     * seek and have no packets to send.
     */
    if (!pStream->IsFirstPacketTSSet())
    {
        SetStreamStartTime(unStreamNumber, (UINT32)~0);
        pStream->SetFirstPacketTS((UINT32)~0);
    }

    if (m_pRateManager)
    {
	IHXPacketFlowControl* pRateMgrFlowControl = NULL;
	if (HXR_OK == m_pRateManager->QueryInterface(IID_IHXPacketFlowControl,
						     (void**)&pRateMgrFlowControl))
	{
	    pRateMgrFlowControl->StreamDone(unStreamNumber);
	    HX_RELEASE(pRateMgrFlowControl);
	}    
    }

    HandleStreamDone(pStream);

    pStream->m_bSentStreamDone = TRUE;

    HX_ASSERT(!pStream->m_uScheduledStreamDoneID);

    if (pStream->m_uScheduledStreamDoneID)
    {
        return;
    }
    else if (!pStream->m_pStreamDoneCallback)
    {
        pStream->m_pStreamDoneCallback =
            new (m_pProc->pc->mem_cache) PacketStreamDoneCallback();

        pStream->m_pStreamDoneCallback->m_pFlow          = pFlow;
        pStream->m_pStreamDoneCallback->m_pTransport     = pTransport;
        pStream->m_pStreamDoneCallback->m_pStream        = pStream;
        pStream->m_pStreamDoneCallback->m_unStreamNumber = unStreamNumber;
        pStream->m_pStreamDoneCallback->AddRef();
    }

    Timeval tNow = m_pProc->pc->engine->now;
    Timeval tCallbackTime;

    pStream->m_uScheduledStreamDoneID =
        m_pProc->pc->engine->schedule.enter(tCallbackTime,
                                            pStream->m_pStreamDoneCallback);

    if (!pStream->m_uScheduledStreamDoneID)
        HX_RELEASE(pStream->m_pStreamDoneCallback);
}
예제 #24
0
ClientRegTree::~ClientRegTree()
{
    DeleteRegEntry();

    HX_RELEASE(m_pRegistry);
    HX_RELEASE(m_pClassFactory);
    HX_RELEASE(m_pContext);
}
예제 #25
0
void
GetTypeTest::cleanup()
{
    HX_DELETE(m_pBRD);
    HX_RELEASE(m_pSHdr);
    HX_RELEASE(m_pBufA);
    HX_RELEASE(m_pBufB);
}
예제 #26
0
CloakConn::~CloakConn(void)
{
    HX_RELEASE(m_pRTSPProt);
    HX_RELEASE(m_pGETHandler);
    HX_RELEASE(m_pRTSPSvrProt);
    HX_RELEASE(m_pRefSock);
    HXDestroyMutex(m_pMutex);
}
예제 #27
0
void
FunctionalityTest::cleanup()
{
    HX_DELETE(m_pBRD);
    HX_RELEASE(m_pSHdr);
    HX_RELEASE(m_pBufA);
    HX_RELEASE(m_pBufB);
}
예제 #28
0
///////////////////////
//
// CHXAudioDeviceHookBase::~CHXAudioDeviceHookBase
//
//  Destructor for CHXAudioDeviceHookBase.
//
CHXAudioDeviceHookBase::~CHXAudioDeviceHookBase()
{
    // Free streaming resources in case it hasn't been done by the client
    InternalFreeStreamingResources();

    HX_RELEASE( m_pContext );
    HX_RELEASE( m_pHook );
};
예제 #29
0
CHXAudioDevice::~CHXAudioDevice()
{
    Close(TRUE);
    m_iTimer.Close();
    HX_DELETE(m_pPrioritySettings);
    HX_RELEASE(m_pContext);
    HX_RELEASE(m_pErrorMessages);
}
예제 #30
0
STDMETHODIMP HXCloakedV2TCPSocket::Init( HXSockFamily   family,
                                         HXSockType     type,
                                         HXSockProtocol protocol)
{
    HX_RESULT res = HXR_FAIL;

    m_family = family;
    m_type = type;
    m_protocol = protocol;
    
    //Create the TCP socket to transport our HTTP requests.
    HX_ASSERT(m_pNetworkServices);
    if(m_pNetworkServices)
    {
        if( m_pTCPSocket )
        {
            m_pTCPSocket->Close();
            HX_RELEASE( m_pTCPSocket );
        }
        res = m_pNetworkServices->CreateSocket(&m_pTCPSocket);
        if(m_pTCPSocket && SUCCEEDED(res) )
        {
            res = m_pTCPSocket->SetResponse(this);
            if( SUCCEEDED(res) )
            {
                res = m_pTCPSocket->Init(family, type, protocol);
                m_pTCPSocket->SetOption( HX_SOCKOPT_APP_BUFFER_TYPE,
                                         HX_SOCKBUF_DEFAULT);
                m_pTCPSocket->SelectEvents(HX_SOCK_EVENT_READ|
                                           HX_SOCK_EVENT_CONNECT|
                                           HX_SOCK_EVENT_CLOSE);
        

            }
        }
        if( m_pNetworkServices && SUCCEEDED(res) && !m_pResolver )
        {
            res = m_pNetworkServices->CreateResolver(&m_pResolver);
            if( SUCCEEDED(res) && m_pResolver )
            {
                res = m_pResolver->Init(this);
            }
        }
    }
    
    if( !SUCCEEDED(res) )
    {
        if( m_pTCPSocket )
        {
            m_pTCPSocket->Close();
            HX_RELEASE(m_pTCPSocket);
        }
        
        HX_RELEASE(m_pResolver);
    }

    return res;
}