unix: Close on EOF if already shutdown

This commit is contained in:
Ryan Dahl 2011-05-04 15:36:40 -07:00
parent 636c75e0b6
commit e9dcf598cc
3 changed files with 17 additions and 1 deletions

13
README
View File

@ -2,6 +2,17 @@ This is the new networking layer for Node. Its purpose is to abstract
IOCP on windows and libev on Unix systems. We intend to eventually contain
all platform differences in this library.
http://nodejs.org/
== Design
The goal of this library is to provide high-concurrency high-performance I/O
on all operating systems. This is a large undertaking. Some of the API
decisions may seem arbitrary but are actually borne out of various specific
platform issues.
=== oio_read_start(), oio_read_stop()
Originally we wanted to provide a asynchronous read function that was
similar to

View File

@ -561,6 +561,10 @@ void oio__read(oio_handle* handle) {
oio_err_new_artificial(handle, OIO_EOF);
ev_io_stop(EV_DEFAULT_UC_ &handle->read_watcher);
handle->read_cb(handle, -1, buf);
if (oio_flag_is_set(handle, OIO_SHUT)) {
oio_close(handle);
}
return;
} else {
/* Successful read */

View File

@ -201,6 +201,7 @@ BENCHMARK_IMPL(ping_pongs) {
pinger_new();
oio_run();
printf("completed_pingers %d\n", completed_pingers);
ASSERT(completed_pingers == 1);
return 0;