Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
uv: upgrade to 5816f2d
  • Loading branch information
ry authored and bnoordhuis committed Oct 7, 2011
1 parent 76f6af6 commit 626a258
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deps/uv/Makefile
Expand Up @@ -80,7 +80,7 @@ endif
TESTS=test/blackhole-server.c test/echo-server.c test/test-*.c
BENCHMARKS=test/blackhole-server.c test/echo-server.c test/dns-server.c test/benchmark-*.c

all: uv.a test/run-tests$(E) test/run-benchmarks$(E)
all: uv.a

$(CARES_OBJS): %.o: %.c
$(CC) -o $*.o -c $(CFLAGS) $(CPPFLAGS) $< -DHAVE_CONFIG_H
Expand Down
19 changes: 11 additions & 8 deletions deps/uv/src/unix/stream.c
Expand Up @@ -563,6 +563,7 @@ static void uv__read(uv_stream_t* stream) {
return;
} else {
/* Successful read */
size_t buflen = buf.len;

if (stream->read_cb) {
stream->read_cb(stream, nread, buf);
Expand Down Expand Up @@ -600,6 +601,11 @@ static void uv__read(uv_stream_t* stream) {
stream->read2_cb((uv_pipe_t*)stream, nread, buf, UV_UNKNOWN_HANDLE);
}
}

/* Return if we didn't fill the buffer, there is no more data to read. */
if (nread < buflen) {
return;
}
}
}
}
Expand Down Expand Up @@ -907,14 +913,11 @@ int uv_read2_start(uv_stream_t* stream, uv_alloc_cb alloc_cb,


int uv_read_stop(uv_stream_t* stream) {
uv_tcp_t* tcp = (uv_tcp_t*)stream;

((uv_handle_t*)tcp)->flags &= ~UV_READING;

ev_io_stop(tcp->loop->ev, &tcp->read_watcher);
tcp->read_cb = NULL;
tcp->read2_cb = NULL;
tcp->alloc_cb = NULL;
ev_io_stop(stream->loop->ev, &stream->read_watcher);
stream->flags &= ~UV_READING;
stream->read_cb = NULL;
stream->read2_cb = NULL;
stream->alloc_cb = NULL;
return 0;
}

Expand Down
28 changes: 25 additions & 3 deletions deps/uv/test/test-fs.c
Expand Up @@ -1163,13 +1163,21 @@ TEST_IMPL(fs_symlink) {

TEST_IMPL(fs_utime) {
utime_check_t checkme;
const char* path = ".";
const char* path = "test_file";
double atime;
double mtime;
uv_fs_t req;
int r;

/* Setup. */
loop = uv_default_loop();
unlink(path);
r = uv_fs_open(loop, &req, path, O_RDWR | O_CREAT,
S_IWRITE | S_IREAD, NULL);
ASSERT(r != -1);
ASSERT(req.result != -1);
uv_fs_req_cleanup(&req);
close(r);

atime = mtime = 400497753; /* 1982-09-10 11:22:33 */

Expand All @@ -1196,24 +1204,35 @@ TEST_IMPL(fs_utime) {
uv_run(loop);
ASSERT(utime_cb_count == 1);

/* Cleanup. */
unlink(path);

return 0;
}


TEST_IMPL(fs_futime) {
utime_check_t checkme;
const char* path = ".";
const char* path = "test_file";
double atime;
double mtime;
uv_file file;
uv_fs_t req;
int r;

/* Setup. */
loop = uv_default_loop();
unlink(path);
r = uv_fs_open(loop, &req, path, O_RDWR | O_CREAT,
S_IWRITE | S_IREAD, NULL);
ASSERT(r != -1);
ASSERT(req.result != -1);
uv_fs_req_cleanup(&req);
close(r);

atime = mtime = 400497753; /* 1982-09-10 11:22:33 */

r = uv_fs_open(loop, &req, path, O_RDONLY, 0, NULL);
r = uv_fs_open(loop, &req, path, O_RDWR, 0, NULL);
ASSERT(r != -1);
ASSERT(req.result != -1);
file = req.result; /* FIXME probably not how it's supposed to be used */
Expand Down Expand Up @@ -1243,6 +1262,9 @@ TEST_IMPL(fs_futime) {
uv_run(loop);
ASSERT(futime_cb_count == 1);

/* Cleanup. */
unlink(path);

return 0;
}

Expand Down

0 comments on commit 626a258

Please sign in to comment.