diff options
author | yoav-steinberg <yoav@monfort.co.il> | 2020-10-28 21:13:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-28 21:13:44 +0200 |
commit | 84b3c18f71ec5b03e58a823fbf75de9c4c80969c (patch) | |
tree | ec12b94b1147586e2e03eb953956b8246e194f61 /src/connection.c | |
parent | 441bfa2dfb57e0dbfddad167bafa559b3f051b5b (diff) | |
download | redis-84b3c18f71ec5b03e58a823fbf75de9c4c80969c.tar.gz |
Add local address to CLIENT LIST, and a CLIENT KILL filter. (#7913)
Useful when you want to know through which bind address the client connected to
the server in case of multiple bind addresses.
- Adding `laddr` field to CLIENT list showing the local (bind) address.
- Adding `LADDR` option to CLIENT KILL to kill all the clients connected
to a specific local address.
- Refactoring to share code.
Diffstat (limited to 'src/connection.c')
-rw-r--r-- | src/connection.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/connection.c b/src/connection.c index 83fb84d6d..a4610a42e 100644 --- a/src/connection.c +++ b/src/connection.c @@ -374,15 +374,15 @@ int connGetSocketError(connection *conn) { } int connPeerToString(connection *conn, char *ip, size_t ip_len, int *port) { - return anetPeerToString(conn ? conn->fd : -1, ip, ip_len, port); + return anetFdToString(conn ? conn->fd : -1, ip, ip_len, port, FD_TO_PEER_NAME); } -int connFormatPeer(connection *conn, char *buf, size_t buf_len) { - return anetFormatPeer(conn ? conn->fd : -1, buf, buf_len); +int connSockName(connection *conn, char *ip, size_t ip_len, int *port) { + return anetFdToString(conn->fd, ip, ip_len, port, FD_TO_SOCK_NAME); } -int connSockName(connection *conn, char *ip, size_t ip_len, int *port) { - return anetSockName(conn->fd, ip, ip_len, port); +int connFormatFdAddr(connection *conn, char *buf, size_t buf_len, int fd_to_str_type) { + return anetFormatFdAddr(conn ? conn->fd : -1, buf, buf_len, fd_to_str_type); } int connBlock(connection *conn) { |