wrowe 2002/07/15 00:56:14
Modified: buckets apr_buckets_socket.c
network_io/unix sendrecv.c
test client.c sendfile.c server.c testsockopt.c
Log:
APR occurances to update for socket_opt_get/set and socket_timeout_get/set
Revision Changes Path
1.41 +4 -4 apr-util/buckets/apr_buckets_socket.c
Index: apr_buckets_socket.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_socket.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- apr_buckets_socket.c 2 Jun 2002 19:54:49 -0000 1.40
+++ apr_buckets_socket.c 15 Jul 2002 07:56:13 -0000 1.41
@@ -60,11 +60,11 @@
apr_socket_t *p = a->data;
char *buf;
apr_status_t rv;
- apr_int32_t timeout;
+ apr_interval_time_t timeout;
if (block == APR_NONBLOCK_READ) {
- apr_getsocketopt(p, APR_SO_TIMEOUT, &timeout);
- apr_setsocketopt(p, APR_SO_TIMEOUT, 0);
+ apr_socket_timeout_get(p, &timeout);
+ apr_socket_timeout_set(p, 0);
}
*str = NULL;
@@ -74,7 +74,7 @@
rv = apr_recv(p, buf, len);
if (block == APR_NONBLOCK_READ) {
- apr_setsocketopt(p, APR_SO_TIMEOUT, timeout);
+ apr_socket_timeout_set(p, timeout);
}
if (rv != APR_SUCCESS && rv != APR_EOF) {
1.88 +6 -6 apr/network_io/unix/sendrecv.c
Index: sendrecv.c
===================================================================
RCS file: /home/cvs/apr/network_io/unix/sendrecv.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- sendrecv.c 11 Jul 2002 05:19:44 -0000 1.87
+++ sendrecv.c 15 Jul 2002 07:56:13 -0000 1.88
@@ -293,7 +293,7 @@
apr_size_t hdrbytes;
/* cork before writing headers */
- rv = apr_setsocketopt(sock, APR_TCP_NOPUSH, 1);
+ rv = apr_socket_opt_set(sock, APR_TCP_NOPUSH, 1);
if (rv != APR_SUCCESS) {
return rv;
}
@@ -316,7 +316,7 @@
}
if (hdrbytes < total_hdrbytes) {
*len = hdrbytes;
- return apr_setsocketopt(sock, APR_TCP_NOPUSH, 0);
+ return apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0);
}
}
@@ -355,7 +355,7 @@
if (rv == -1) {
*len = nbytes;
rv = errno;
- apr_setsocketopt(sock, APR_TCP_NOPUSH, 0);
+ apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0);
return rv;
}
@@ -363,7 +363,7 @@
if (rv < *len) {
*len = nbytes;
- arv = apr_setsocketopt(sock, APR_TCP_NOPUSH, 0);
+ arv = apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0);
if (rv > 0) {
/* If this was a partial write, return now with the
@@ -393,12 +393,12 @@
if (arv != APR_SUCCESS) {
*len = nbytes;
rv = errno;
- apr_setsocketopt(sock, APR_TCP_NOPUSH, 0);
+ apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0);
return rv;
}
}
- apr_setsocketopt(sock, APR_TCP_NOPUSH, 0);
+ apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0);
(*len) = nbytes;
return rv < 0 ? errno : APR_SUCCESS;
1.36 +1 -1 apr/test/client.c
Index: client.c
===================================================================
RCS file: /home/cvs/apr/test/client.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- client.c 5 Jul 2002 00:11:10 -0000 1.35
+++ client.c 15 Jul 2002 07:56:13 -0000 1.36
@@ -118,7 +118,7 @@
fprintf(stdout, "OK\n");
fprintf(stdout, "\tClient: Setting socket timeout.......");
- stat = apr_setsocketopt(sock, APR_SO_TIMEOUT, timeout);
+ stat = apr_socket_timeout_set(sock, timeout);
if (stat) {
fprintf(stderr, "Problem setting timeout: %d\n", stat);
exit(-1);
1.22 +6 -7 apr/test/sendfile.c
Index: sendfile.c
===================================================================
RCS file: /home/cvs/apr/test/sendfile.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- sendfile.c 11 Jul 2002 05:19:45 -0000 1.21
+++ sendfile.c 15 Jul 2002 07:56:13 -0000 1.22
@@ -259,9 +259,9 @@
break;
case NONBLK:
/* set it non-blocking */
- rv = apr_setsocketopt(sock, APR_SO_NONBLOCK, 1);
+ rv = apr_socket_opt_set(sock, APR_SO_NONBLOCK, 1);
if (rv != APR_SUCCESS) {
- fprintf(stderr, "apr_setsocketopt(APR_SO_NONBLOCK)->%d/%s\n",
+ fprintf(stderr, "apr_socket_opt_set(APR_SO_NONBLOCK)->%d/%s\n",
rv,
apr_strerror(rv, buf, sizeof buf));
exit(1);
@@ -269,10 +269,9 @@
break;
case TIMEOUT:
/* set a timeout */
- rv = apr_setsocketopt(sock, APR_SO_TIMEOUT,
- 100 * APR_USEC_PER_SEC);
+ rv = apr_socket_timeout_set(sock, 100 * APR_USEC_PER_SEC);
if (rv != APR_SUCCESS) {
- fprintf(stderr, "apr_setsocketopt(APR_SO_NONBLOCK)->%d/%s\n",
+ fprintf(stderr, "apr_socket_opt_set(APR_SO_NONBLOCK)->%d/%s\n",
rv,
apr_strerror(rv, buf, sizeof buf));
exit(1);
@@ -519,9 +518,9 @@
family = APR_UNSPEC;
apr_setup(&p, &sock, &family);
- rv = apr_setsocketopt(sock, APR_SO_REUSEADDR, 1);
+ rv = apr_socket_opt_set(sock, APR_SO_REUSEADDR, 1);
if (rv != APR_SUCCESS) {
- fprintf(stderr, "apr_setsocketopt()->%d/%s\n",
+ fprintf(stderr, "apr_socket_opt_set()->%d/%s\n",
rv,
apr_strerror(rv, buf, sizeof buf));
exit(1);
1.36 +2 -2 apr/test/server.c
Index: server.c
===================================================================
RCS file: /home/cvs/apr/test/server.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- server.c 11 Jul 2002 05:19:45 -0000 1.35
+++ server.c 15 Jul 2002 07:56:13 -0000 1.36
@@ -116,10 +116,10 @@
apr_socket_create(&sock, family, SOCK_STREAM, context))
APR_TEST_SUCCESS(rv, "Setting option APR_SO_NONBLOCK",
- apr_setsocketopt(sock, APR_SO_NONBLOCK, 1))
+ apr_socket_opt_set(sock, APR_SO_NONBLOCK, 1))
APR_TEST_SUCCESS(rv, "Setting option APR_SO_REUSEADDR",
- apr_setsocketopt(sock, APR_SO_REUSEADDR, 1))
+ apr_socket_opt_set(sock, APR_SO_REUSEADDR, 1))
if (!localsa) {
apr_socket_addr_get(&localsa, APR_LOCAL, sock);
1.12 +11 -11 apr/test/testsockopt.c
Index: testsockopt.c
===================================================================
RCS file: /home/cvs/apr/test/testsockopt.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- testsockopt.c 13 Mar 2002 20:39:27 -0000 1.11
+++ testsockopt.c 15 Jul 2002 07:56:13 -0000 1.12
@@ -111,7 +111,7 @@
printf("OK\n");
printf ("\tTrying to set APR_SO_KEEPALIVE...........");
- if (apr_setsocketopt(sock, APR_SO_KEEPALIVE, 1) != APR_SUCCESS){
+ if (apr_socket_opt_set(sock, APR_SO_KEEPALIVE, 1) != APR_SUCCESS){
apr_socket_close(sock);
printf("Failed!\n");
exit (-1);
@@ -119,7 +119,7 @@
printf ("OK\n");
printf("\tChecking if we recorded it...............");
- if (apr_getsocketopt(sock, APR_SO_KEEPALIVE, &ck) != APR_SUCCESS){
+ if (apr_socket_opt_get(sock, APR_SO_KEEPALIVE, &ck) != APR_SUCCESS){
apr_socket_close(sock);
fprintf(stderr,"Failed\n");
exit(-1);
@@ -132,14 +132,14 @@
printf("Yes\n");
printf("\tTrying to set APR_SO_DEBUG...............");
- if (apr_setsocketopt(sock, APR_SO_DEBUG, 1) != APR_SUCCESS){
+ if (apr_socket_opt_set(sock, APR_SO_DEBUG, 1) != APR_SUCCESS){
printf("Failed (ignored)\n");
}
else {
printf ("OK\n");
printf("\tChecking if we recorded it...............");
- if (apr_getsocketopt(sock, APR_SO_DEBUG, &ck) != APR_SUCCESS){
+ if (apr_socket_opt_get(sock, APR_SO_DEBUG, &ck) != APR_SUCCESS){
apr_socket_close(sock);
printf("Failed!\n");
exit (-1);
@@ -153,7 +153,7 @@
}
printf ("\tTrying to remove APR_SO_KEEPALIVE........");
- if (apr_setsocketopt(sock, APR_SO_KEEPALIVE, 0) != APR_SUCCESS){
+ if (apr_socket_opt_set(sock, APR_SO_KEEPALIVE, 0) != APR_SUCCESS){
apr_socket_close(sock);
printf("Failed!\n");
exit (-1);
@@ -161,7 +161,7 @@
printf ("OK\n");
printf ("\tDid we record the removal................");
- if (apr_getsocketopt(sock, APR_SO_KEEPALIVE, &ck) != APR_SUCCESS){
+ if (apr_socket_opt_get(sock, APR_SO_KEEPALIVE, &ck) != APR_SUCCESS){
apr_socket_close(sock);
printf("Didn't get value!\n");
exit(-1);
@@ -174,17 +174,17 @@
#if APR_HAVE_CORKABLE_TCP
printf ("\tTesting APR_TCP_NOPUSH!\n");
printf("\t\tSetting APR_TCP_NODELAY..........");
- if (apr_setsocketopt(sock, APR_TCP_NODELAY, 1) != APR_SUCCESS){
+ if (apr_socket_opt_set(sock, APR_TCP_NODELAY, 1) != APR_SUCCESS){
failure(sock);
}
printf("OK\n");
printf("\t\tSetting APR_TCP_NOPUSH...........");
- if (apr_setsocketopt(sock, APR_TCP_NOPUSH, 1) != APR_SUCCESS){
+ if (apr_socket_opt_set(sock, APR_TCP_NOPUSH, 1) != APR_SUCCESS){
failure(sock);
}
printf("OK\n");
printf("\t\tChecking on APR_TCP_NODELAY......");
- if (apr_getsocketopt(sock, APR_TCP_NODELAY, &ck) != APR_SUCCESS){
+ if (apr_socket_opt_get(sock, APR_TCP_NODELAY, &ck) != APR_SUCCESS){
failure(sock);
}
if (ck != 0){
@@ -192,13 +192,13 @@
}
printf("Yes (not set)\n");
printf("\t\tUnsetting APR_TCP_NOPUSH.........");
- if (apr_setsocketopt(sock, APR_TCP_NOPUSH, 0) != APR_SUCCESS){
+ if (apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0) != APR_SUCCESS){
failure(sock);
}
printf("OK\n");
printf("\t\tChecking on APR_TCP_NODELAY......");
- if (apr_getsocketopt(sock, APR_TCP_NODELAY, &ck) != APR_SUCCESS){
+ if (apr_socket_opt_get(sock, APR_TCP_NODELAY, &ck) != APR_SUCCESS){
failure(sock);
}
if (ck != 1){