Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
unix: add a few asserts, cosmetic touch ups
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Aug 23, 2011
1 parent 4e9edce commit bdd880e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/uv-unix.c
Expand Up @@ -226,6 +226,9 @@ void uv_close(uv_handle_t* handle, uv_close_cb close_cb) {
uv__close(stream->accepted_fd);
stream->accepted_fd = -1;
}

assert(!ev_is_active(&stream->read_watcher));
assert(!ev_is_active(&stream->write_watcher));
break;

case UV_PREPARE:
Expand Down Expand Up @@ -824,17 +827,18 @@ static void uv__read(uv_stream_t* stream) {

assert(buf.len > 0);
assert(buf.base);
assert(stream->fd >= 0);

do {
nread = read(stream->fd, buf.base, buf.len);
}
while (nread == -1 && errno == EINTR);
while (nread < 0 && errno == EINTR);

if (nread < 0) {

This comment has been minimized.

Copy link
@leetreveil

leetreveil Aug 23, 2011

Don't need this if anymore?

This comment has been minimized.

Copy link
@bnoordhuis

bnoordhuis Aug 24, 2011

Contributor

Still do. The check in the while loop is only for EINTR.

/* Error */
if (errno == EAGAIN) {
/* Wait for the next one. */
if (((uv_handle_t*)stream)->flags & UV_READING) {
if (stream->flags & UV_READING) {
ev_io_start(EV_DEFAULT_UC_ &stream->read_watcher);
}
uv_err_new((uv_handle_t*)stream, EAGAIN);
Expand Down

0 comments on commit bdd880e

Please sign in to comment.