Fix bug with reused file descriptors (#471)

* Fix bug with reused file descriptors

* Remove client connection if write_object_chunk fails

* Handle ECONNRESET on unsuccessful write

* lint

* Back to lowercase

* fix compilation

* fix linting
This commit is contained in:
Stephanie Wang
2017-05-02 19:45:27 -07:00
committed by Philipp Moritz
parent 2bbfc5da8d
commit e50a23b820
6 changed files with 53 additions and 29 deletions
+5 -3
View File
@@ -20,7 +20,7 @@ void event_loop_destroy(event_loop *loop) {
aeDeleteEventLoop(loop);
}
void event_loop_add_file(event_loop *loop,
bool event_loop_add_file(event_loop *loop,
int fd,
int events,
event_loop_file_handler handler,
@@ -30,11 +30,13 @@ void event_loop_add_file(event_loop *loop,
/* If it cannot be added, increase the size of the event loop. */
if (err == AE_ERR && errno == ERANGE) {
err = aeResizeSetSize(loop, 3 * aeGetSetSize(loop) / 2);
CHECK(err == AE_OK);
if (err != AE_OK) {
return false;
}
err = aeCreateFileEvent(loop, fd, events, handler, context);
}
/* In any case, test if there were errors. */
CHECK(err == AE_OK);
return (err == AE_OK);
}
void event_loop_remove_file(event_loop *loop, int fd) {