brianp 2002/08/02 14:02:12
Modified: test testpoll.c
Log:
Test apr_poll() with larger numbers of descriptors
Revision Changes Path
1.16 +20 -1 apr/test/testpoll.c
Index: testpoll.c
===================================================================
RCS file: /home/cvs/apr/test/testpoll.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- testpoll.c 2 Aug 2002 05:20:32 -0000 1.15
+++ testpoll.c 2 Aug 2002 21:02:12 -0000 1.16
@@ -149,6 +149,7 @@
apr_socket_t *s[LARGE_NUM_SOCKETS];
apr_sockaddr_t *sa[LARGE_NUM_SOCKETS];
apr_pollfd_t *pollarray;
+ apr_pollfd_t *pollarray_large;
apr_pollset_t *pollset;
int i = 0, srv = SMALL_NUM_SOCKETS;
apr_int32_t num;
@@ -180,17 +181,29 @@
}
printf("OK\n");
- printf ("\tSetting up the poll array I'll use........");
+ printf ("\tSetting up the poll arrays I'll use........");
if (apr_poll_setup(&pollarray, SMALL_NUM_SOCKETS, context) !=
APR_SUCCESS){
printf("Couldn't create a poll array!\n");
exit (-1);
}
+ if (apr_poll_setup(&pollarray_large, LARGE_NUM_SOCKETS, context) !=
+ APR_SUCCESS){
+ printf("Couldn't create a poll array!\n");
+ exit (-1);
+ }
for (i = 0; i < SMALL_NUM_SOCKETS;i++){
if (apr_poll_socket_add(pollarray, s[i], APR_POLLIN) != APR_SUCCESS){
printf("Failed to add socket %d\n", i);
exit (-1);
}
}
+ for (i = 0; i < LARGE_NUM_SOCKETS;i++){
+ if (apr_poll_socket_add(pollarray_large, s[i], APR_POLLIN) !=
+ APR_SUCCESS){
+ printf("Failed to add socket %d\n", i);
+ exit (-1);
+ }
+ }
printf("OK\n");
printf("Starting Tests\n");
@@ -221,6 +234,12 @@
recv_msg(s, 0, context);
recv_msg(s, 2, context);
+
+ send_msg(s, sa, LARGE_NUM_SOCKETS - 1);
+ apr_poll(pollarray_large, LARGE_NUM_SOCKETS, &srv, 10 *
APR_USEC_PER_SEC);
+ check_sockets(pollarray_large, s);
+ recv_msg(s, LARGE_NUM_SOCKETS - 1, context);
+
printf("Tests completed.\n");