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
295db9ee
Unverified
Commit
295db9ee
authored
Jun 11, 2018
by
Salvatore Sanfilippo
Committed by
GitHub
Jun 11, 2018
Browse files
Merge pull request #5003 from soloestoy/streams-checkType
Streams: checkType for xread & xinfo
parents
163f32c2
b8913ce7
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/t_stream.c
View file @
295db9ee
...
@@ -1310,14 +1310,13 @@ void xreadCommand(client *c) {
...
@@ -1310,14 +1310,13 @@ void xreadCommand(client *c) {
* starting from now. */
* starting from now. */
int
id_idx
=
i
-
streams_arg
-
streams_count
;
int
id_idx
=
i
-
streams_arg
-
streams_count
;
robj
*
key
=
c
->
argv
[
i
-
streams_count
];
robj
*
key
=
c
->
argv
[
i
-
streams_count
];
robj
*
o
;
robj
*
o
=
lookupKeyRead
(
c
->
db
,
key
);
if
(
o
&&
checkType
(
c
,
o
,
OBJ_STREAM
))
goto
cleanup
;
streamCG
*
group
=
NULL
;
streamCG
*
group
=
NULL
;
/* If a group was specified, than we need to be sure that the
/* If a group was specified, than we need to be sure that the
* key and group actually exist. */
* key and group actually exist. */
if
(
groupname
)
{
if
(
groupname
)
{
o
=
lookupKeyRead
(
c
->
db
,
key
);
if
(
o
&&
checkType
(
c
,
o
,
OBJ_STREAM
))
goto
cleanup
;
if
(
o
==
NULL
||
if
(
o
==
NULL
||
(
group
=
streamLookupCG
(
o
->
ptr
,
groupname
->
ptr
))
==
NULL
)
(
group
=
streamLookupCG
(
o
->
ptr
,
groupname
->
ptr
))
==
NULL
)
{
{
...
@@ -1331,8 +1330,6 @@ void xreadCommand(client *c) {
...
@@ -1331,8 +1330,6 @@ void xreadCommand(client *c) {
}
}
if
(
strcmp
(
c
->
argv
[
i
]
->
ptr
,
"$"
)
==
0
)
{
if
(
strcmp
(
c
->
argv
[
i
]
->
ptr
,
"$"
)
==
0
)
{
o
=
lookupKeyRead
(
c
->
db
,
key
);
if
(
o
&&
checkType
(
c
,
o
,
OBJ_STREAM
))
goto
cleanup
;
if
(
o
)
{
if
(
o
)
{
stream
*
s
=
o
->
ptr
;
stream
*
s
=
o
->
ptr
;
ids
[
id_idx
]
=
s
->
last_id
;
ids
[
id_idx
]
=
s
->
last_id
;
...
@@ -2179,7 +2176,7 @@ NULL
...
@@ -2179,7 +2176,7 @@ NULL
/* Lookup the key now, this is common for all the subcommands but HELP. */
/* Lookup the key now, this is common for all the subcommands but HELP. */
robj
*
o
=
lookupKeyWriteOrReply
(
c
,
key
,
shared
.
nokeyerr
);
robj
*
o
=
lookupKeyWriteOrReply
(
c
,
key
,
shared
.
nokeyerr
);
if
(
o
==
NULL
)
return
;
if
(
o
==
NULL
||
checkType
(
c
,
o
,
OBJ_STREAM
)
)
return
;
s
=
o
->
ptr
;
s
=
o
->
ptr
;
/* Dispatch the different subcommands. */
/* Dispatch the different subcommands. */
...
...
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