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

Function getClientPeerId

src/networking.cpp:2852–2860  ·  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

2850 * The Peer ID never changes during the life of the client, however it
2851 * is expensive to compute. */
2852char *getClientPeerId(client *c) {
2853 char peerid[NET_ADDR_STR_LEN];
2854
2855 if (c->peerid == NULL) {
2856 genClientAddrString(c,peerid,sizeof(peerid),FD_TO_PEER_NAME);
2857 c->peerid = sdsnew(peerid);
2858 }
2859 return c->peerid;
2860}
2861
2862/* This function returns the client bound socket name, by creating and caching
2863 * it if client->sockname is NULL, otherwise returning the cached value.

Callers 4

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

Calls 2

genClientAddrStringFunction · 0.85
sdsnewFunction · 0.85

Tested by

no test coverage detected