VirtualBox

Changeset 26627 in vbox


Ignore:
Timestamp:
Feb 18, 2010 1:12:34 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
57830
Message:

XPCOM: fix bug handling empty "client down" containers, regression in previous change

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/dconnect/src/ipcDConnectService.cpp

    r26582 r26627  
    13121312        // entries and free one element if there's still no space (if needed).
    13131313        PRIntervalTime now = PR_IntervalNow();
    1314         do {
     1314        while (!g_ClientDownList.empty())
     1315        {
    13151316            ClientDownInfo *cInfo = g_ClientDownList.back();
    1316             if (!cInfo)
    1317                 break;
    13181317            PRInt64 diff = (PRInt64)now - cInfo->uTimestamp;
    13191318            if (diff < 0)
     
    13231322                g_ClientDownMap.erase(cInfo->uClient);
    13241323                g_ClientDownList.pop_back();
     1324                NS_ASSERTION(g_ClientDownMap.size() == g_ClientDownList.size(),
     1325                             "client down info inconsistency during expiry");
    13251326                delete cInfo;
    13261327            }
    13271328            else
    13281329                break;
    1329         } while (true);
     1330        }
    13301331
    13311332        ClientDownMap::iterator it = g_ClientDownMap.find(aSenderID);
    13321333        if (it == g_ClientDownMap.end())
    13331334        {
    1334             while (g_ClientDownList.size() >= MAX_CLIENT_DOWN_SIZE)
     1335            /* Getting size of a map is O(1), size of a list can be O(n). */
     1336            while (g_ClientDownMap.size() >= MAX_CLIENT_DOWN_SIZE)
    13351337            {
    13361338                ClientDownInfo *cInfo = g_ClientDownList.back();
    13371339                g_ClientDownMap.erase(cInfo->uClient);
    13381340                g_ClientDownList.pop_back();
     1341                NS_ASSERTION(g_ClientDownMap.size() == g_ClientDownList.size(),
     1342                             "client down info inconsistency during emergency evicting");
    13391343                delete cInfo;
    13401344            }
     
    13431347            g_ClientDownMap[aSenderID] = cInfo;
    13441348            g_ClientDownList.push_front(cInfo);
     1349            NS_ASSERTION(g_ClientDownMap.size() == g_ClientDownList.size(),
     1350                         "client down info inconsistency after adding entry");
    13451351        }
    13461352        return (aSenderID == mPeer) ? NS_OK : IPC_WAIT_NEXT_MESSAGE;
     
    13561362            g_ClientDownMap.erase(it);
    13571363            g_ClientDownList.remove(cInfo);
     1364            NS_ASSERTION(g_ClientDownMap.size() == g_ClientDownList.size(),
     1365                         "client down info inconsistency in client up case");
    13581366            delete cInfo;
    13591367        }
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette