summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2009-06-05 19:52:13 +0000
committerNick Mathewson <nickm@torproject.org>2009-06-05 19:52:13 +0000
commitd1ffba1d7ce3979e8aefbdd0a26036fe974e5242 (patch)
tree543aed7e9fdb561e467b3acb3e898feff78c35ba
parenta43a1c2b237b2bcd0806635055a62f7406a16f2f (diff)
downloadlibevent-d1ffba1d7ce3979e8aefbdd0a26036fe974e5242.tar.gz
Replace some read/write instances with send/recv to work properly on win32.
svn:r1324
-rw-r--r--ChangeLog2
-rw-r--r--test/bench.c6
-rw-r--r--test/bench_cascade.c6
-rw-r--r--test/regress_et.c4
-rw-r--r--test/test-eof.c4
-rw-r--r--test/test-weof.c2
6 files changed, 13 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index ea9e2f27..b8a0cc34 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -34,6 +34,8 @@ Changes in 2.0.2-alpha:
o Fix a memory error when freeing a thread-enabled event base with registered events. (Spotted by Joachim Bauch.)
o Try to contain degree of failure when running on a win32 version so heavily firewalled that we can't fake a socketpair.
o Activate fd events in a pseudorandom order with O(N) backends, so that we don't systematically favor low fds (select) or earlier-added fds (poll, win32).
+ o Replace some read()/write() instances with send()/recv() to work properly
+ on win32.
Changes in 2.0.1-alpha:
diff --git a/test/bench.c b/test/bench.c
index c065bb97..9e57d16a 100644
--- a/test/bench.c
+++ b/test/bench.c
@@ -70,11 +70,11 @@ read_cb(int fd, short which, void *arg)
long idx = (long) arg, widx = idx + 1;
u_char ch;
- count += read(fd, &ch, sizeof(ch));
+ count += recv(fd, &ch, sizeof(ch), 0);
if (writes) {
if (widx >= num_pipes)
widx -= num_pipes;
- write(pipes[2 * widx + 1], "e", 1);
+ send(pipes[2 * widx + 1], "e", 1, 0);
writes--;
fired++;
}
@@ -99,7 +99,7 @@ run_once(void)
space = num_pipes / num_active;
space = space * 2;
for (i = 0; i < num_active; i++, fired++)
- write(pipes[i * space + 1], "e", 1);
+ send(pipes[i * space + 1], "e", 1, 0);
count = 0;
writes = num_writes;
diff --git a/test/bench_cascade.c b/test/bench_cascade.c
index e9984ae5..d0607645 100644
--- a/test/bench_cascade.c
+++ b/test/bench_cascade.c
@@ -66,9 +66,9 @@ read_cb(int fd, short which, void *arg)
char ch;
long idx = (long) arg;
- read(fd, &ch, sizeof(ch));
+ recv(fd, &ch, sizeof(ch), 0);
if (idx >= 0)
- write(idx, "e", 1);
+ send(idx, "e", 1, 0);
fired++;
}
@@ -109,7 +109,7 @@ run_once(int num_pipes)
fired = 0;
/* kick everything off with a single write */
- write(pipes[1], "e", 1);
+ send(pipes[1], "e", 1, 0);
event_dispatch();
diff --git a/test/regress_et.c b/test/regress_et.c
index 54e2a3d3..c1930a44 100644
--- a/test/regress_et.c
+++ b/test/regress_et.c
@@ -55,7 +55,7 @@ read_cb(int fd, short event, void *arg)
char buf;
int len;
- len = read(fd, &buf, sizeof(buf));
+ len = recv(fd, &buf, sizeof(buf), 0);
/*printf("%s: %s %d%s\n", __func__, event & EV_ET ? "etread" : "read",
len, len ? "" : " - means EOF");
@@ -95,7 +95,7 @@ test_edgetriggered(void *et)
called = was_et = 0;
- write(pair[0], test, strlen(test)+1);
+ send(pair[0], test, strlen(test)+1, 0);
shutdown(pair[0], SHUT_WR);
/* Initalize the event library */
diff --git a/test/test-eof.c b/test/test-eof.c
index 5706aed6..099242c4 100644
--- a/test/test-eof.c
+++ b/test/test-eof.c
@@ -35,7 +35,7 @@ read_cb(int fd, short event, void *arg)
char buf[256];
int len;
- len = read(fd, buf, sizeof(buf));
+ len = recv(fd, buf, sizeof(buf), 0);
printf("%s: read %d%s\n", __func__,
len, len ? "" : " - means EOF");
@@ -64,7 +64,7 @@ main (int argc, char **argv)
return (1);
- write(pair[0], test, strlen(test)+1);
+ send(pair[0], test, strlen(test)+1, 0);
shutdown(pair[0], SHUT_WR);
/* Initalize the event library */
diff --git a/test/test-weof.c b/test/test-weof.c
index 73af086b..c5444f76 100644
--- a/test/test-weof.c
+++ b/test/test-weof.c
@@ -39,7 +39,7 @@ write_cb(int fd, short event, void *arg)
const char *test = "test string";
int len;
- len = write(fd, test, strlen(test) + 1);
+ len = send(fd, test, strlen(test) + 1, 0);
printf("%s: write %d%s\n", __func__,
len, len ? "" : " - means EOF");