示例#1
0
SIPXHANDLE SipXHandleMap::allocHandle(const void* pData) 
{
    lock() ;
    SIPXHANDLE hCall = mNextHandle++ ;
    insertKeyAndValue(new UtlInt(hCall), new UtlVoidPtr((void*) pData)) ;
    addHandleRef(hCall);
    unlock() ;

    return hCall ;
}
示例#2
0
HttpConnectionMapEntry* HttpConnectionMap::getPersistentConnection(const Url& url,
                                                                   OsConnectionSocket*& socket)
{
    UtlString keyString;
    socket = NULL;

    getPersistentUriKey(url, keyString);

    HttpConnectionMapEntry* pEntry;

    { // table lock scope
       OsLock lock(mLock);

       pEntry = dynamic_cast<HttpConnectionMapEntry*>(findValue(&keyString));
       if (!pEntry)
       {
          // Now create a new one
          pEntry = new HttpConnectionMapEntry("ConnectionMapEntry-%d");
          if (pEntry)
          {
             if (insertKeyAndValue(new UtlString(keyString.data()), pEntry) != NULL)
             {
                OsSysLog::add(FAC_HTTP, PRI_DEBUG,
                              "HttpConnectionMap::getPersistentConnection "
                              "- Adding %s for %s",
                              pEntry->data(), keyString.data());
             }
             else
             {
                OsSysLog::add(FAC_HTTP, PRI_ERR,
                              "HttpConnectionMap::getPersistentConnection "
                              "- adding %s (entry %s) failed)",
                              keyString.data(), pEntry->data());
                delete pEntry;
                pEntry = NULL;
             }
          }
       }
    } // end of  table lock

    if (pEntry)
    {
       pEntry->mLock.acquire();
       socket = pEntry->mpSocket;
       pEntry->mbInUse = true;
       OsSysLog::add(FAC_HTTP, PRI_DEBUG,
                     "HttpConnectionMap::getPersistentConnection - Found %s for %s, socket %p",
                     pEntry->data(), keyString.data(), socket);

    }

    return pEntry;
}
示例#3
0
SIPXHANDLE SipXHandleMap::allocHandle(const void* pData) 
{
    SIPXHANDLE rc = SIPXHANDLE_NULL;

    if (lock())
    {
        rc = mNextHandle++ ;
        insertKeyAndValue(new UtlInt(rc), new UtlVoidPtr((void*) pData)) ;
        addHandleRef(rc);
        unlock() ;
    }

    return rc;
}
示例#4
0
MpAlsa* MpAlsaContainer::getALSADeviceWrapper(const UtlString& ossdev)
{
   OsLock lock(mMutex);

   MpAlsa *pDev;
   UtlString* pName;

   pDev = static_cast<MpAlsa*>(findValue(&ossdev));

   if (pDev == NULL)
   {
      pName = new UtlString(ossdev);
      pDev = new MpAlsa;
      insertKeyAndValue(pName, pDev);
   }

   return pDev;
}
示例#5
0
// insert a key with a NULL value
UtlContainable* UtlHashMap::insert(UtlContainable* obj)
{
   // Locking will be done by insertKeyAndValue().

   return insertKeyAndValue(obj, NULL);
}