don't give up on an HTTP rhizome transfer on an empty read if

the error is EAGAIN.
This commit is contained in:
gardners 2013-08-25 17:35:34 +09:30
parent 0d85d60566
commit 53c9a406e1

View File

@ -1423,6 +1423,7 @@ void rhizome_fetch_poll(struct sched_ent *alarm)
/* Keep reading until we have the promised amount of data */
unsigned char buffer[8192];
sigPipeFlag = 0;
errno=0;
int bytes = read_nonblock(slot->alarm.poll.fd, buffer, sizeof buffer);
/* If we got some data, see if we have found the end of the HTTP request */
if (bytes > 0) {
@ -1434,10 +1435,12 @@ void rhizome_fetch_poll(struct sched_ent *alarm)
schedule(&slot->alarm);
return;
} else {
if (errno!=EAGAIN) {
if (config.debug.rhizome_rx)
DEBUGF("Empty read, closing connection: received %"PRId64" of %"PRId64" bytes",
slot->write_state.file_offset,slot->write_state.file_length);
rhizome_fetch_switch_to_mdp(slot);
}
return;
}
if (sigPipeFlag) {