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
7b52ef1d
Commit
7b52ef1d
authored
Apr 25, 2016
by
Oran Agra
Browse files
networking.c minor optimization
parent
f8909a25
Changes
1
Show whitespace changes
Inline
Side-by-side
src/networking.c
View file @
7b52ef1d
...
@@ -1204,10 +1204,10 @@ int processMultibulkBuffer(client *c) {
...
@@ -1204,10 +1204,10 @@ int processMultibulkBuffer(client *c) {
{
{
c
->
argv
[
c
->
argc
++
]
=
createObject
(
OBJ_STRING
,
c
->
querybuf
);
c
->
argv
[
c
->
argc
++
]
=
createObject
(
OBJ_STRING
,
c
->
querybuf
);
sdsIncrLen
(
c
->
querybuf
,
-
2
);
/* remove CRLF */
sdsIncrLen
(
c
->
querybuf
,
-
2
);
/* remove CRLF */
c
->
querybuf
=
sdsempty
();
/* Assume that if we saw a fat argument we'll see another one
/* Assume that if we saw a fat argument we'll see another one
* likely... */
* likely... */
c
->
querybuf
=
sdsMakeRoomFor
(
c
->
querybuf
,
c
->
bulklen
+
2
);
c
->
querybuf
=
sdsnewlen
(
NULL
,
c
->
bulklen
+
2
);
sdsclear
(
c
->
querybuf
);
pos
=
0
;
pos
=
0
;
}
else
{
}
else
{
c
->
argv
[
c
->
argc
++
]
=
c
->
argv
[
c
->
argc
++
]
=
...
@@ -1443,9 +1443,8 @@ sds getAllClientsInfoString(void) {
...
@@ -1443,9 +1443,8 @@ sds getAllClientsInfoString(void) {
listNode
*
ln
;
listNode
*
ln
;
listIter
li
;
listIter
li
;
client
*
client
;
client
*
client
;
sds
o
=
sdsempty
();
sds
o
=
sdsnewlen
(
NULL
,
200
*
listLength
(
server
.
clients
));
sdsclear
(
o
);
o
=
sdsMakeRoomFor
(
o
,
200
*
listLength
(
server
.
clients
));
listRewind
(
server
.
clients
,
&
li
);
listRewind
(
server
.
clients
,
&
li
);
while
((
ln
=
listNext
(
&
li
))
!=
NULL
)
{
while
((
ln
=
listNext
(
&
li
))
!=
NULL
)
{
client
=
listNodeValue
(
ln
);
client
=
listNodeValue
(
ln
);
...
@@ -1887,7 +1886,7 @@ int clientsArePaused(void) {
...
@@ -1887,7 +1886,7 @@ int clientsArePaused(void) {
* and so forth.
* and so forth.
*
*
* It calls the event loop in order to process a few events. Specifically we
* It calls the event loop in order to process a few events. Specifically we
* try to call the event loop
for
times as long as we receive acknowledge that
* try to call the event loop
4
times as long as we receive acknowledge that
* some event was processed, in order to go forward with the accept, read,
* some event was processed, in order to go forward with the accept, read,
* write, close sequence needed to serve a client.
* write, close sequence needed to serve a client.
*
*
...
...
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