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
063ecbd5
Commit
063ecbd5
authored
Sep 28, 2015
by
antirez
Browse files
writeToClient(): don't remove write handler if not needed.
parent
b741a90c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/networking.c
View file @
063ecbd5
...
@@ -818,7 +818,7 @@ void freeClientsInAsyncFreeQueue(void) {
...
@@ -818,7 +818,7 @@ void freeClientsInAsyncFreeQueue(void) {
/* Write data in output buffers to client. Return C_OK if the client
/* Write data in output buffers to client. Return C_OK if the client
* is still valid after the call, C_ERR if it was freed. */
* is still valid after the call, C_ERR if it was freed. */
int
writeToClient
(
int
fd
,
client
*
c
)
{
int
writeToClient
(
int
fd
,
client
*
c
,
int
handler_installed
)
{
ssize_t
nwritten
=
0
,
totwritten
=
0
;
ssize_t
nwritten
=
0
,
totwritten
=
0
;
size_t
objlen
;
size_t
objlen
;
size_t
objmem
;
size_t
objmem
;
...
@@ -892,7 +892,7 @@ int writeToClient(int fd, client *c) {
...
@@ -892,7 +892,7 @@ int writeToClient(int fd, client *c) {
}
}
if
(
c
->
bufpos
==
0
&&
listLength
(
c
->
reply
)
==
0
)
{
if
(
c
->
bufpos
==
0
&&
listLength
(
c
->
reply
)
==
0
)
{
c
->
sentlen
=
0
;
c
->
sentlen
=
0
;
aeDeleteFileEvent
(
server
.
el
,
c
->
fd
,
AE_WRITABLE
);
if
(
handler_installed
)
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
&
CLIENT_CLOSE_AFTER_REPLY
)
{
if
(
c
->
flags
&
CLIENT_CLOSE_AFTER_REPLY
)
{
...
@@ -907,7 +907,7 @@ int writeToClient(int fd, client *c) {
...
@@ -907,7 +907,7 @@ int writeToClient(int fd, client *c) {
void
sendReplyToClient
(
aeEventLoop
*
el
,
int
fd
,
void
*
privdata
,
int
mask
)
{
void
sendReplyToClient
(
aeEventLoop
*
el
,
int
fd
,
void
*
privdata
,
int
mask
)
{
UNUSED
(
el
);
UNUSED
(
el
);
UNUSED
(
mask
);
UNUSED
(
mask
);
writeToClient
(
fd
,
privdata
);
writeToClient
(
fd
,
privdata
,
1
);
}
}
/* This function is called just before entering the event loop, in the hope
/* This function is called just before entering the event loop, in the hope
...
@@ -925,7 +925,7 @@ void handleClientsWithPendingWrites(void) {
...
@@ -925,7 +925,7 @@ void handleClientsWithPendingWrites(void) {
listDelNode
(
server
.
clients_pending_write
,
ln
);
listDelNode
(
server
.
clients_pending_write
,
ln
);
/* Try to write buffers to the client socket. */
/* Try to write buffers to the client socket. */
if
(
writeToClient
(
c
->
fd
,
c
)
==
C_ERR
)
continue
;
if
(
writeToClient
(
c
->
fd
,
c
,
0
)
==
C_ERR
)
continue
;
/* If there is nothing left, do nothing. Otherwise install
/* If there is nothing left, do nothing. Otherwise install
* the write handler. */
* the write handler. */
...
...
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