示例#1
0
/*=========================================================================*/
void SLPDPropertyDeinit()
/*=========================================================================*/
{
    SLPPropertyFreeAll();     
}
示例#2
0
/*=========================================================================*/
void SLPClose(SLPHandle hSLP)                                             
/*                                                                         */
/* Frees all resources associated with the handle.  If the handle was      */
/* invalid, the function returns silently.  Any outstanding synchronous    */
/* or asynchronous operations are cancelled so their callback functions    */
/* will not be called any further.                                         */
/*                                                                         */
/* SLPHandle    A SLPHandle handle returned from a call to SLPOpen().      */
/*=========================================================================*/
{
    PSLPHandleInfo   handle;

    /*------------------------------*/
    /* check for invalid parameters */
    /*------------------------------*/
    if(hSLP == 0 || *(unsigned int*)hSLP != SLP_HANDLE_SIG)
    {
        return;
    }

    handle = (PSLPHandleInfo)hSLP;

    if(handle->isAsync)
    {
        /* TODO: stop the usage of this handle (kill threads, etc) */
    }

    if(handle->langtag)
    {
        xfree(handle->langtag);
    }

    if(handle->dasock >=0)
    {
        #ifdef WIN32
        closesocket(handle->dasock);
        #else
        close(handle->dasock);
        #endif
    }

    if(handle->dascope)
    {
        xfree(handle->dascope);
    }

    if(handle->sasock >=0)
    {
        #ifdef WIN32
        closesocket(handle->sasock);
        #else
        close(handle->sasock);
        #endif
    }

    if(handle->sascope)
    {
        xfree(handle->sascope);
    }

#ifdef ENABLE_SLPv2_SECURITY
    if(handle->hspi) SLPSpiClose(handle->hspi);
#endif

    handle->sig = 0;  /* If they use the handle again, it won't be valid */

    xfree(hSLP);

    G_OpenSLPHandleCount --;
    

#if DEBUG
    /* Free additional resources if this is the last handle open */
    if(G_OpenSLPHandleCount <= 0)
    {
        G_OpenSLPHandleCount = 0;

        SLPPropertyFreeAll();
        
        KnownDAFreeAll();
        
        xmalloc_deinit();
    }
#endif

}