mirror of
https://github.com/fluencelabs/redis
synced 2025-06-21 21:11:33 +00:00
Assign an unique non-repeating ID to each new client.
This will be used by CLIENT KILL and is also a good way to ensure a given client is still the same across CLIENT LIST calls. The output of CLIENT LIST was modified to include the new ID, but this change is considered to be backward compatible as the API does not imply you can do positional parsing, since each filed as a different name.
This commit is contained in:
@ -83,6 +83,7 @@ redisClient *createClient(int fd) {
|
||||
}
|
||||
|
||||
selectDb(c,0);
|
||||
c->id = server.next_client_id++;
|
||||
c->fd = fd;
|
||||
c->name = NULL;
|
||||
c->bufpos = 0;
|
||||
@ -1302,7 +1303,8 @@ sds catClientInfoString(sds s, redisClient *client) {
|
||||
if (emask & AE_WRITABLE) *p++ = 'w';
|
||||
*p = '\0';
|
||||
return sdscatfmt(s,
|
||||
"addr=%s fd=%i name=%s age=%I idle=%I flags=%s db=%i sub=%i psub=%i multi=%i qbuf=%U qbuf-free=%U obl=%U oll=%U omem=%U events=%s cmd=%s",
|
||||
"id=%U addr=%s fd=%i name=%s age=%I idle=%I flags=%s db=%i sub=%i psub=%i multi=%i qbuf=%U qbuf-free=%U obl=%U oll=%U omem=%U events=%s cmd=%s",
|
||||
(unsigned long long) client->id,
|
||||
getClientPeerId(client),
|
||||
client->fd,
|
||||
client->name ? (char*)client->name->ptr : "",
|
||||
|
Reference in New Issue
Block a user