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. */
| 2271 | * The Peer ID never changes during the life of the client, however it |
| 2272 | * is expensive to compute. */ |
| 2273 | char *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. |
no test coverage detected