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

Function getAllClientsInfoString

src/networking.cpp:2950–2966  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2948}
2949
2950sds getAllClientsInfoString(int type) {
2951 listNode *ln;
2952 listIter li;
2953 client *client;
2954 sds o = sdsnewlen(SDS_NOINIT,200*listLength(g_pserver->clients));
2955 sdsclear(o);
2956 listRewind(g_pserver->clients,&li);
2957 while ((ln = listNext(&li)) != NULL) {
2958 client = reinterpret_cast<struct client*>(listNodeValue(ln));
2959 std::unique_lock<decltype(client->lock)> lock(client->lock);
2960 if (client->flags & CLIENT_CLOSE_ASAP) continue;
2961 if (type != -1 && getClientType(client) != type) continue;
2962 o = catClientInfoString(o,client);
2963 o = sdscatlen(o,"\n",1);
2964 }
2965 return o;
2966}
2967
2968/* This function implements CLIENT SETNAME, including replying to the
2969 * user with an error if the charset is wrong (in that case C_ERR is

Callers 2

logServerInfoFunction · 0.85
clientCommandFunction · 0.85

Calls 7

sdsnewlenFunction · 0.85
sdsclearFunction · 0.85
listRewindFunction · 0.85
listNextFunction · 0.85
getClientTypeFunction · 0.85
catClientInfoStringFunction · 0.85
sdscatlenFunction · 0.85

Tested by

no test coverage detected