MCPcopy Create free account
hub / github.com/F-Stack/f-stack / getClientPeerId

Function getClientPeerId

app/redis-6.2.6/src/networking.c:2273–2281  ·  view source on GitHub ↗

This function returns the client peer id, by creating and caching it * if client->peerid is NULL, otherwise returning the cached value. * The Peer ID never changes during the life of the client, however it * is expensive to compute. */

Source from the content-addressed store, hash-verified

2271 * The Peer ID never changes during the life of the client, however it
2272 * is expensive to compute. */
2273char *getClientPeerId(client *c) {
2274 char peerid[NET_ADDR_STR_LEN];
2275
2276 if (c->peerid == NULL) {
2277 genClientAddrString(c,peerid,sizeof(peerid),FD_TO_PEER_NAME);
2278 c->peerid = sdsnew(peerid);
2279 }
2280 return c->peerid;
2281}
2282
2283/* This function returns the client bound socket name, by creating and caching
2284 * it if client->sockname is NULL, otherwise returning the cached value.

Callers 4

replicationFeedMonitorsFunction · 0.85
slowlogCreateEntryFunction · 0.85
catClientInfoStringFunction · 0.85
clientCommandFunction · 0.85

Calls 2

genClientAddrStringFunction · 0.85
sdsnewFunction · 0.85

Tested by

no test coverage detected