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
5e78edb3
Commit
5e78edb3
authored
Oct 28, 2010
by
Pieter Noordhuis
Browse files
Unify two client flags that mean the same
parent
a375b077
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
5e78edb3
...
@@ -541,7 +541,6 @@ void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) {
...
@@ -541,7 +541,6 @@ void sendReplyToClient(aeEventLoop *el, int fd, void *privdata, int mask) {
aeDeleteFileEvent
(
server
.
el
,
c
->
fd
,
AE_WRITABLE
);
aeDeleteFileEvent
(
server
.
el
,
c
->
fd
,
AE_WRITABLE
);
/* Close connection after entire reply has been sent. */
/* Close connection after entire reply has been sent. */
if
(
c
->
flags
&
REDIS_QUIT
)
freeClient
(
c
);
if
(
c
->
flags
&
REDIS_CLOSE_AFTER_REPLY
)
freeClient
(
c
);
if
(
c
->
flags
&
REDIS_CLOSE_AFTER_REPLY
)
freeClient
(
c
);
}
}
}
}
...
@@ -802,9 +801,10 @@ void processInputBuffer(redisClient *c) {
...
@@ -802,9 +801,10 @@ void processInputBuffer(redisClient *c) {
* will try to reiterate. The following line will make it return asap. */
* will try to reiterate. The following line will make it return asap. */
if
(
c
->
flags
&
REDIS_BLOCKED
||
c
->
flags
&
REDIS_IO_WAIT
)
return
;
if
(
c
->
flags
&
REDIS_BLOCKED
||
c
->
flags
&
REDIS_IO_WAIT
)
return
;
/* Never continue to process the input buffer after QUIT. After the output
/* REDIS_CLOSE_AFTER_REPLY closes the connection once the reply is
* buffer is flushed (with the OK), the connection will be dropped. */
* written to the client. Make sure to not let the reply grow after
if
(
c
->
flags
&
REDIS_QUIT
)
return
;
* this flag has been set (i.e. don't process more commands). */
if
(
c
->
flags
&
REDIS_CLOSE_AFTER_REPLY
)
return
;
/* Determine request type when unknown. */
/* Determine request type when unknown. */
if
(
!
c
->
reqtype
)
{
if
(
!
c
->
reqtype
)
{
...
...
src/redis.c
View file @
5e78edb3
...
@@ -893,10 +893,10 @@ int processCommand(redisClient *c) {
...
@@ -893,10 +893,10 @@ int processCommand(redisClient *c) {
* go through checking for replication and QUIT will cause trouble
* go through checking for replication and QUIT will cause trouble
* when FORCE_REPLICATION is enabled and would be implemented in
* when FORCE_REPLICATION is enabled and would be implemented in
* a regular command proc. */
* a regular command proc. */
redisAssert
(
!
(
c
->
flags
&
REDIS_
QUIT
));
redisAssert
(
!
(
c
->
flags
&
REDIS_
CLOSE_AFTER_REPLY
));
if
(
!
strcasecmp
(
c
->
argv
[
0
]
->
ptr
,
"quit"
))
{
if
(
!
strcasecmp
(
c
->
argv
[
0
]
->
ptr
,
"quit"
))
{
c
->
flags
|=
REDIS_QUIT
;
addReply
(
c
,
shared
.
ok
);
addReply
(
c
,
shared
.
ok
);
c
->
flags
|=
REDIS_CLOSE_AFTER_REPLY
;
return
REDIS_ERR
;
return
REDIS_ERR
;
}
}
...
...
src/redis.h
View file @
5e78edb3
...
@@ -144,9 +144,7 @@
...
@@ -144,9 +144,7 @@
#define REDIS_BLOCKED 16
/* The client is waiting in a blocking operation */
#define REDIS_BLOCKED 16
/* The client is waiting in a blocking operation */
#define REDIS_IO_WAIT 32
/* The client is waiting for Virtual Memory I/O */
#define REDIS_IO_WAIT 32
/* The client is waiting for Virtual Memory I/O */
#define REDIS_DIRTY_CAS 64
/* Watched keys modified. EXEC will fail. */
#define REDIS_DIRTY_CAS 64
/* Watched keys modified. EXEC will fail. */
#define REDIS_QUIT 128
/* Client will be disconnected after reply is sent */
#define REDIS_CLOSE_AFTER_REPLY 128
/* Close after writing entire reply. */
#define REDIS_CLOSE_AFTER_REPLY 256
/* Close connection immediately once the
* reply has been sent. */
/* Client request types */
/* Client request types */
#define REDIS_REQ_INLINE 1
#define REDIS_REQ_INLINE 1
...
...
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