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
hiredis
Commits
300b3d32
Commit
300b3d32
authored
Jan 05, 2012
by
Pieter Noordhuis
Browse files
Retry read/write on EINTR
parent
9bb22da6
Changes
1
Hide whitespace changes
Inline
Side-by-side
handle.c
View file @
300b3d32
...
@@ -334,11 +334,16 @@ int redis_handle_write_from_buffer(redis_handle *h, int *drained) {
...
@@ -334,11 +334,16 @@ int redis_handle_write_from_buffer(redis_handle *h, int *drained) {
}
}
if
(
sdslen
(
h
->
wbuf
))
{
if
(
sdslen
(
h
->
wbuf
))
{
nwritten
=
write
(
h
->
fd
,
h
->
wbuf
,
sdslen
(
h
->
wbuf
));
do
{
nwritten
=
write
(
h
->
fd
,
h
->
wbuf
,
sdslen
(
h
->
wbuf
));
}
while
(
nwritten
==
-
1
&&
errno
==
EINTR
);
if
(
nwritten
==
-
1
)
{
if
(
nwritten
==
-
1
)
{
/* Let all errors bubble, including EAGAIN */
/* Let all errors bubble, including EAGAIN */
return
REDIS_ESYS
;
return
REDIS_ESYS
;
}
else
if
(
nwritten
>
0
)
{
}
if
(
nwritten
>
0
)
{
h
->
wbuf
=
sdsrange
(
h
->
wbuf
,
nwritten
,
-
1
);
h
->
wbuf
=
sdsrange
(
h
->
wbuf
,
nwritten
,
-
1
);
}
}
}
}
...
@@ -369,11 +374,16 @@ int redis_handle_read_to_buffer(redis_handle *h) {
...
@@ -369,11 +374,16 @@ int redis_handle_read_to_buffer(redis_handle *h) {
return
REDIS_ESYS
;
return
REDIS_ESYS
;
}
}
nread
=
read
(
h
->
fd
,
buf
,
sizeof
(
buf
));
do
{
nread
=
read
(
h
->
fd
,
buf
,
sizeof
(
buf
));
}
while
(
nread
==
-
1
&&
errno
==
EINTR
);
if
(
nread
==
-
1
)
{
if
(
nread
==
-
1
)
{
/* Let all errors bubble, including EAGAIN */
/* Let all errors bubble, including EAGAIN */
return
REDIS_ESYS
;
return
REDIS_ESYS
;
}
else
if
(
nread
==
0
)
{
}
if
(
nread
==
0
)
{
return
REDIS_EEOF
;
return
REDIS_EEOF
;
}
}
...
...
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