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
2c74a9f9
Commit
2c74a9f9
authored
Nov 24, 2011
by
antirez
Browse files
last executed command in CLIENT LIST output.
parent
3c95e721
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
2c74a9f9
...
@@ -36,7 +36,7 @@ redisClient *createClient(int fd) {
...
@@ -36,7 +36,7 @@ redisClient *createClient(int fd) {
c
->
reqtype
=
0
;
c
->
reqtype
=
0
;
c
->
argc
=
0
;
c
->
argc
=
0
;
c
->
argv
=
NULL
;
c
->
argv
=
NULL
;
c
->
cmd
=
NULL
;
c
->
cmd
=
c
->
lastcmd
=
NULL
;
c
->
multibulklen
=
0
;
c
->
multibulklen
=
0
;
c
->
bulklen
=
-
1
;
c
->
bulklen
=
-
1
;
c
->
sentlen
=
0
;
c
->
sentlen
=
0
;
...
@@ -966,7 +966,7 @@ sds getClientInfoString(redisClient *client) {
...
@@ -966,7 +966,7 @@ sds getClientInfoString(redisClient *client) {
if
(
emask
&
AE_WRITABLE
)
*
p
++
=
'w'
;
if
(
emask
&
AE_WRITABLE
)
*
p
++
=
'w'
;
*
p
=
'\0'
;
*
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 events=%s"
,
"addr=%s:%d fd=%d idle=%ld flags=%s db=%d sub=%d psub=%d qbuf=%lu obl=%lu oll=%lu events=%s
cmd=%s
"
,
ip
,
port
,
client
->
fd
,
ip
,
port
,
client
->
fd
,
(
long
)(
now
-
client
->
lastinteraction
),
(
long
)(
now
-
client
->
lastinteraction
),
flags
,
flags
,
...
@@ -976,7 +976,8 @@ sds getClientInfoString(redisClient *client) {
...
@@ -976,7 +976,8 @@ sds getClientInfoString(redisClient *client) {
(
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
);
events
,
client
->
lastcmd
?
client
->
lastcmd
->
name
:
"NULL"
);
}
}
void
clientCommand
(
redisClient
*
c
)
{
void
clientCommand
(
redisClient
*
c
)
{
...
...
src/redis.c
View file @
2c74a9f9
...
@@ -1174,7 +1174,7 @@ int processCommand(redisClient *c) {
...
@@ -1174,7 +1174,7 @@ int processCommand(redisClient *c) {
/* Now lookup the command and check ASAP about trivial error conditions
/* Now lookup the command and check ASAP about trivial error conditions
* such as wrong arity, bad command name and so forth. */
* such as wrong arity, bad command name and so forth. */
c
->
cmd
=
lookupCommand
(
c
->
argv
[
0
]
->
ptr
);
c
->
cmd
=
c
->
lastcmd
=
lookupCommand
(
c
->
argv
[
0
]
->
ptr
);
if
(
!
c
->
cmd
)
{
if
(
!
c
->
cmd
)
{
addReplyErrorFormat
(
c
,
"unknown command '%s'"
,
addReplyErrorFormat
(
c
,
"unknown command '%s'"
,
(
char
*
)
c
->
argv
[
0
]
->
ptr
);
(
char
*
)
c
->
argv
[
0
]
->
ptr
);
...
...
src/redis.h
View file @
2c74a9f9
...
@@ -294,7 +294,7 @@ typedef struct redisClient {
...
@@ -294,7 +294,7 @@ typedef struct redisClient {
sds
querybuf
;
sds
querybuf
;
int
argc
;
int
argc
;
robj
**
argv
;
robj
**
argv
;
struct
redisCommand
*
cmd
;
struct
redisCommand
*
cmd
,
*
lastcmd
;
int
reqtype
;
int
reqtype
;
int
multibulklen
;
/* number of multi bulk arguments left to read */
int
multibulklen
;
/* number of multi bulk arguments left to read */
long
bulklen
;
/* length of bulk argument in multi bulk request */
long
bulklen
;
/* length of bulk argument in multi bulk request */
...
...
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