manoj 99/06/03 16:37:45
Modified: pthreads/src/main buff.c
Log:
Now, {send,recv}withtimeout can handle both non-blocking I/O (timeout =
0), and fully blocking I/O (timeout = -1). This makes these routines
look more like the APR functions.
Revision Changes Path
1.10 +6 -6 apache-apr/pthreads/src/main/buff.c
Index: buff.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -u -r1.9 -r1.10
--- buff.c 1999/06/01 21:36:03 1.9
+++ buff.c 1999/06/03 23:37:44 1.10
@@ -126,18 +126,18 @@
int err = EAGAIN;
int rv;
- tv.tv_sec = sec;
- if (tv.tv_sec == 0) {
+ if (sec == -1) {
return (write(sock, buf, len));
}
ap_bnonblock(sock);
rv = write(sock, buf, len);
- if (rv == -1) {
+ if (rv == -1 && sec != 0) {
err = errno;
if (err == EAGAIN || errno == EINTR) {
FD_ZERO(&fdset);
FD_SET(sock, &fdset);
+ tv.tv_sec = sec;
tv.tv_usec = 0;
do {
rv = select(FD_SETSIZE, NULL, &fdset, NULL, &tv);
@@ -161,17 +161,17 @@
int err = EAGAIN;
int rv;
- tv.tv_sec = sec;
- if (tv.tv_sec == 0) {
+ if (sec == -1) {
return (read(sock, buf, len));
}
ap_bnonblock(sock);
rv = read(sock, buf, len);
- if (rv == -1) {
+ if (rv == -1 && sec != 0) {
err = errno;
if (err == EAGAIN || errno == EINTR) {
FD_ZERO(&fdset);
FD_SET(sock, &fdset);
+ tv.tv_sec = sec;
tv.tv_usec = 0;
do {
rv = select(FD_SETSIZE, &fdset, NULL, NULL, &tv);