rbb 99/09/03 07:33:13
Modified: src/lib/apr/network_io/unix sockets.c src/lib/apr/test Makefile.in ab_apr.c client.c server.c Log: Fix the test programs to use the new timeout API's in network I/O. Also, fix a minor bug in the new timeout code. I forgot to initialize the timeout. Revision Changes Path 1.3 +1 -0 apache-2.0/src/lib/apr/network_io/unix/sockets.c Index: sockets.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockets.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- sockets.c 1999/09/02 20:33:36 1.2 +++ sockets.c 1999/09/03 14:33:11 1.3 @@ -108,6 +108,7 @@ if ((*new)->socketdes < 0) { return errno; } + (*new)->timeout = -1; ap_register_cleanup((*new)->cntxt, (void *)(*new), socket_cleanup, NULL); return APR_SUCCESS; 1.3 +1 -1 apache-2.0/src/lib/apr/test/Makefile.in Index: Makefile.in =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/test/Makefile.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Makefile.in 1999/08/18 20:18:59 1.2 +++ Makefile.in 1999/09/03 14:33:11 1.3 @@ -8,7 +8,7 @@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ [EMAIL PROTECTED]@ @OPTIM@ -LIBS=-L../network_io -lnetwork -L../threadproc -lthreadproc -L../file_io -lfile -L../misc -lmisc -L../lib -lapr -L../time -ltime -L../locks -llock -L../signal -lsig -lcrypt @LIBS@ +LIBS=-L../libs -lnetwork -lthreadproc -lfile -lmisc -lapr -ltime -llock -lsig -lcrypt @LIBS@ [EMAIL PROTECTED]@ $(LIBS) INCDIR=../include INCDIR1=../../inc 1.3 +5 -3 apache-2.0/src/lib/apr/test/ab_apr.c Index: ab_apr.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/test/ab_apr.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- ab_apr.c 1999/08/31 05:32:51 1.2 +++ ab_apr.c 1999/09/03 14:33:12 1.3 @@ -219,12 +219,13 @@ { ap_ssize_t len = reqlen; ap_current_time(c->connect); - if (ap_send(c->aprsock, request, &reqlen, 30) != APR_SUCCESS && + ap_setsocketopt(c->aprsock, APR_SO_TIMEOUT, 30); + if (ap_send(c->aprsock, request, &reqlen) != APR_SUCCESS && reqlen != len) { printf("Send request failed!\n"); } if (posting) { - ap_send(c->aprsock, postdata, &postlen, 30); + ap_send(c->aprsock, postdata, &postlen); totalposted += (reqlen + postlen); } @@ -518,7 +519,8 @@ char respcode[4]; /* 3 digits and null */ r = sizeof(buffer); - ap_recv(c->aprsock, buffer, &r, aprtimeout); + ap_setsocketopt(c->aprsock, APR_SO_TIMEOUT, aprtimeout); + ap_recv(c->aprsock, buffer, &r); if (r == 0 || (r < 0 && errno != EAGAIN)) { good++; close_connection(c); 1.2 +3 -3 apache-2.0/src/lib/apr/test/client.c Index: client.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/test/client.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- client.c 1999/08/17 15:59:46 1.1 +++ client.c 1999/09/03 14:33:12 1.2 @@ -113,7 +113,7 @@ fprintf(stdout, "\tClient: Trying to send data over socket......."); length = STRLEN; - if (ap_send(sock, datasend, &length, 5) != APR_SUCCESS) { + if (ap_send(sock, datasend, &length) != APR_SUCCESS) { ap_close_socket(sock); fprintf(stderr, "Problem sending data\n"); exit(-1); @@ -122,7 +122,7 @@ length = STRLEN; fprintf(stdout, "\tClient: Trying to receive data over socket......."); - if (ap_recv(sock, datarecv, &length, 5) != APR_SUCCESS) { + if (ap_recv(sock, datarecv, &length) != APR_SUCCESS) { ap_close_socket(sock); fprintf(stderr, "Problem receiving data\n"); exit(-1); @@ -150,4 +150,4 @@ fprintf(stdout, "OK\n"); return 1; -} \ No newline at end of file +} 1.2 +2 -2 apache-2.0/src/lib/apr/test/server.c Index: server.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/test/server.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- server.c 1999/08/17 15:59:46 1.1 +++ server.c 1999/09/03 14:33:12 1.2 @@ -145,7 +145,7 @@ length = STRLEN; fprintf(stdout, "\tServer: Trying to recv data from socket......."); - if (ap_recv(sock2, datasend, &length, 5) != APR_SUCCESS) { + if (ap_recv(sock2, datasend, &length) != APR_SUCCESS) { ap_close_socket(sock); ap_close_socket(sock2); fprintf(stderr, "Problem recving data\n"); @@ -161,7 +161,7 @@ length = STRLEN; fprintf(stdout, "\tServer: Sending data over socket......."); - if (ap_send(sock2, datarecv, &length, 5) != APR_SUCCESS) { + if (ap_send(sock2, datarecv, &length) != APR_SUCCESS) { ap_close_socket(sock); ap_close_socket(sock2); fprintf(stderr, "Problem sending data\n");