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
e0e1c195
Commit
e0e1c195
authored
Aug 30, 2010
by
antirez
Browse files
Fixed MONITOR mode and Issue 296
parent
8fedd04d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
e0e1c195
...
...
@@ -221,19 +221,19 @@ void keysCommand(redisClient *c) {
dictIterator
*
di
;
dictEntry
*
de
;
sds
pattern
=
c
->
argv
[
1
]
->
ptr
;
int
plen
=
sdslen
(
pattern
);
int
plen
=
sdslen
(
pattern
)
,
allkeys
;
unsigned
long
numkeys
=
0
;
robj
*
lenobj
=
createObject
(
REDIS_STRING
,
NULL
);
di
=
dictGetIterator
(
c
->
db
->
dict
);
addReply
(
c
,
lenobj
);
decrRefCount
(
lenobj
);
allkeys
=
(
pattern
[
0
]
==
'*'
&&
pattern
[
1
]
==
'\0'
);
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
sds
key
=
dictGetEntryKey
(
de
);
robj
*
keyobj
;
if
((
pattern
[
0
]
==
'*'
&&
pattern
[
1
]
==
'\0'
)
||
stringmatchlen
(
pattern
,
plen
,
key
,
sdslen
(
key
),
0
))
{
if
(
allkeys
||
stringmatchlen
(
pattern
,
plen
,
key
,
sdslen
(
key
),
0
))
{
keyobj
=
createStringObject
(
key
,
sdslen
(
key
));
if
(
expireIfNeeded
(
c
->
db
,
keyobj
)
==
0
)
{
addReplyBulk
(
c
,
keyobj
);
...
...
src/redis-cli.c
View file @
e0e1c195
...
...
@@ -96,7 +96,7 @@ static sds cliReadLine(int fd) {
ssize_t
ret
;
ret
=
read
(
fd
,
&
c
,
1
);
if
(
ret
=
=
-
1
)
{
if
(
ret
<
=
0
)
{
sdsfree
(
line
);
return
NULL
;
}
else
if
((
ret
==
0
)
||
(
c
==
'\n'
))
{
...
...
@@ -282,7 +282,8 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
while
(
repeat
--
)
{
anetWrite
(
fd
,
cmd
,
sdslen
(
cmd
));
while
(
config
.
monitor_mode
)
{
cliReadSingleLineReply
(
fd
,
0
);
if
(
cliReadSingleLineReply
(
fd
,
0
))
exit
(
1
);
printf
(
"
\n
"
);
}
if
(
config
.
pubsub_mode
)
{
...
...
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