Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
93babe4b
Commit
93babe4b
authored
Nov 21, 2011
by
antirez
Browse files
show active events in client file descriptor in CLIENT LIST.
parent
713b4c54
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
93babe4b
...
@@ -885,9 +885,10 @@ void getClientsMaxBuffers(unsigned long *longest_output_list,
...
@@ -885,9 +885,10 @@ void getClientsMaxBuffers(unsigned long *longest_output_list,
/* Turn a Redis client into an sds string representing its state. */
/* Turn a Redis client into an sds string representing its state. */
sds
getClientInfoString
(
redisClient
*
client
)
{
sds
getClientInfoString
(
redisClient
*
client
)
{
char
ip
[
32
],
flags
[
16
],
*
p
;
char
ip
[
32
],
flags
[
16
],
events
[
3
],
*
p
;
int
port
;
int
port
;
time_t
now
=
time
(
NULL
);
time_t
now
=
time
(
NULL
);
int
emask
;
if
(
anetPeerToString
(
client
->
fd
,
ip
,
&
port
)
==
-
1
)
{
if
(
anetPeerToString
(
client
->
fd
,
ip
,
&
port
)
==
-
1
)
{
ip
[
0
]
=
'?'
;
ip
[
0
]
=
'?'
;
...
@@ -910,8 +911,14 @@ sds getClientInfoString(redisClient *client) {
...
@@ -910,8 +911,14 @@ sds getClientInfoString(redisClient *client) {
if
(
client
->
flags
&
REDIS_CLOSE_AFTER_REPLY
)
*
p
++
=
'c'
;
if
(
client
->
flags
&
REDIS_CLOSE_AFTER_REPLY
)
*
p
++
=
'c'
;
if
(
client
->
flags
&
REDIS_UNBLOCKED
)
*
p
++
=
'u'
;
if
(
client
->
flags
&
REDIS_UNBLOCKED
)
*
p
++
=
'u'
;
*
p
++
=
'\0'
;
*
p
++
=
'\0'
;
emask
=
client
->
fd
==
-
1
?
0
:
aeGetFileEvents
(
server
.
el
,
client
->
fd
);
p
=
events
;
if
(
emask
&
AE_READABLE
)
*
p
++
=
'r'
;
if
(
emask
&
AE_WRITABLE
)
*
p
++
=
'w'
;
*
p
=
'\0'
;
return
sdscatprintf
(
sdsempty
(),
return
sdscatprintf
(
sdsempty
(),
"addr=%s:%d fd=%d idle=%ld flags=%s db=%d sub=%d psub=%d qbuf=%lu obl=%lu oll=%lu"
,
"addr=%s:%d fd=%d idle=%ld flags=%s db=%d sub=%d psub=%d qbuf=%lu obl=%lu oll=%lu
events=%s
"
,
ip
,
port
,
client
->
fd
,
ip
,
port
,
client
->
fd
,
(
long
)(
now
-
client
->
lastinteraction
),
(
long
)(
now
-
client
->
lastinteraction
),
flags
,
flags
,
...
@@ -920,7 +927,8 @@ sds getClientInfoString(redisClient *client) {
...
@@ -920,7 +927,8 @@ sds getClientInfoString(redisClient *client) {
(
int
)
listLength
(
client
->
pubsub_patterns
),
(
int
)
listLength
(
client
->
pubsub_patterns
),
(
unsigned
long
)
sdslen
(
client
->
querybuf
),
(
unsigned
long
)
sdslen
(
client
->
querybuf
),
(
unsigned
long
)
client
->
bufpos
,
(
unsigned
long
)
client
->
bufpos
,
(
unsigned
long
)
listLength
(
client
->
reply
));
(
unsigned
long
)
listLength
(
client
->
reply
),
events
);
}
}
void
clientCommand
(
redisClient
*
c
)
{
void
clientCommand
(
redisClient
*
c
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment