This function returns the client bound socket name, by creating and caching * it if client->sockname is NULL, otherwise returning the cached value. * The Socket Name never changes during the life of the client, however it * is expensive to compute. */
| 2285 | * The Socket Name never changes during the life of the client, however it |
| 2286 | * is expensive to compute. */ |
| 2287 | char *getClientSockname(client *c) { |
| 2288 | char sockname[NET_ADDR_STR_LEN]; |
| 2289 | |
| 2290 | if (c->sockname == NULL) { |
| 2291 | genClientAddrString(c,sockname,sizeof(sockname),FD_TO_SOCK_NAME); |
| 2292 | c->sockname = sdsnew(sockname); |
| 2293 | } |
| 2294 | return c->sockname; |
| 2295 | } |
| 2296 | |
| 2297 | /* Concatenate a string representing the state of a client in a human |
| 2298 | * readable format, into the sds string 's'. */ |
no test coverage detected