MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / freeClientsInAsyncFreeQueue

Function freeClientsInAsyncFreeQueue

src/networking.cpp:1774–1800  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1772}
1773
1774int freeClientsInAsyncFreeQueue(int iel) {
1775 serverAssert(GlobalLocksAcquired());
1776 std::unique_lock<fastlock> ul(g_lockasyncfree);
1777 listIter li;
1778 listNode *ln;
1779 listRewind(g_pserver->clients_to_close,&li);
1780
1781 // Store the clients in a temp vector since freeClient will modify this list
1782 std::vector<client*> vecclientsFree;
1783 while((ln = listNext(&li)))
1784 {
1785 client *c = (client*)listNodeValue(ln);
1786 if (c->iel == iel && !(c->flags & CLIENT_PROTECTED) && !c->casyncOpsPending)
1787 {
1788 vecclientsFree.push_back(c);
1789 listDelNode(g_pserver->clients_to_close, ln);
1790 }
1791 }
1792 ul.unlock();
1793
1794 for (client *c : vecclientsFree)
1795 {
1796 c->flags &= ~CLIENT_CLOSE_ASAP;
1797 freeClient(c);
1798 }
1799 return (int)vecclientsFree.size();
1800}
1801
1802/* Return a client by ID, or NULL if the client ID is not in the set
1803 * of registered clients. Note that "fake clients", created with -1 as FD,

Callers 3

clientsCronFunction · 0.85
beforeSleepFunction · 0.85
clientCommandFunction · 0.85

Calls 7

GlobalLocksAcquiredFunction · 0.85
listRewindFunction · 0.85
listNextFunction · 0.85
listDelNodeFunction · 0.85
freeClientFunction · 0.70
unlockMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected