Skip to content

Commit

Permalink
Try again later for EINTR errors (see issue redis#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
thefab committed Nov 6, 2012
1 parent 3c46b13 commit bf161d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hiredis.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ int redisBufferRead(redisContext *c) {

nread = read(c->fd,buf,sizeof(buf));
if (nread == -1) {
if (errno == EAGAIN && !(c->flags & REDIS_BLOCK)) {
if ((errno == EAGAIN && !(c->flags & REDIS_BLOCK)) || (errno == EINTR)) {
/* Try again later */
} else {
__redisSetError(c,REDIS_ERR_IO,NULL);
Expand Down Expand Up @@ -1114,7 +1114,7 @@ int redisBufferWrite(redisContext *c, int *done) {
if (sdslen(c->obuf) > 0) {
nwritten = write(c->fd,c->obuf,sdslen(c->obuf));
if (nwritten == -1) {
if (errno == EAGAIN && !(c->flags & REDIS_BLOCK)) {
if ((errno == EAGAIN && !(c->flags & REDIS_BLOCK)) || (errno == EINTR)) {
/* Try again later */
} else {
__redisSetError(c,REDIS_ERR_IO,NULL);
Expand Down

0 comments on commit bf161d9

Please sign in to comment.