apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@apache.org
Subject cvs commit: apr/test server.c sendfile.c
Date Sat, 22 Nov 2003 00:05:26 GMT
dreid       2003/11/21 16:05:26

  Modified:    test     server.c sendfile.c
  Log:
  Tidy up the poll logic in these files so they build/run again.
  
  Revision  Changes    Path
  1.41      +14 -4     apr/test/server.c
  
  Index: server.c
  ===================================================================
  RCS file: /home/cvs/apr/test/server.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- server.c	3 Sep 2003 14:43:53 -0000	1.40
  +++ server.c	22 Nov 2003 00:05:26 -0000	1.41
  @@ -70,7 +70,8 @@
       apr_socket_t *sock2;
       apr_size_t length;
       apr_int32_t pollres;
  -    apr_pollfd_t *sdset;
  +    apr_pollset_t *sdset;
  +    apr_pollfd_t fdsock;
       char datasend[STRLEN];
       char datarecv[STRLEN] = "Recv data test";
       const char *bind_to_ipaddr = NULL;
  @@ -134,13 +135,22 @@
           apr_socket_listen(sock, 5))
       
       APR_TEST_BEGIN(rv, "Setting up for polling",
  -        apr_poll_setup(&sdset, 1, context))
  +          apr_pollset_create(&sdset, 1, context, 0))
  +
  +    /* Hmm, probably a better way of doing this - quick 'n' dirty :) */
  +    fdsock.p = context;
  +    fdsock.desc_type = APR_POLL_SOCKET;
  +    fdsock.reqevents = APR_POLLIN;
  +    fdsock.rtnevents = 0;
  +    fdsock.desc.s = sock;
  +    fdsock.client_data = NULL;
  +
       APR_TEST_END(rv, 
  -        apr_poll_socket_add(sdset, sock, APR_POLLIN))
  +        apr_pollset_add(sdset, &fdsock))
       
       pollres = 1; 
       APR_TEST_BEGIN(rv, "Polling for socket",
  -        apr_poll(sdset, 1, &pollres, -1))
  +        apr_pollset_poll(sdset, -1, &pollres, NULL))
   
       if (pollres == 0) {
           fprintf(stdout, "Failed\n");
  
  
  
  1.27      +14 -5     apr/test/sendfile.c
  
  Index: sendfile.c
  ===================================================================
  RCS file: /home/cvs/apr/test/sendfile.c,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- sendfile.c	3 Sep 2003 14:43:53 -0000	1.26
  +++ sendfile.c	22 Nov 2003 00:05:26 -0000	1.27
  @@ -216,7 +216,7 @@
       struct iovec headers[3];
       struct iovec trailers[3];
       apr_size_t bytes_read;
  -    apr_pollfd_t *pfd;
  +    apr_pollset_t *pset;
       apr_int32_t nsocks;
       int i;
       int family;
  @@ -339,11 +339,20 @@
       else {
           /* non-blocking... wooooooo */
           apr_size_t total_bytes_sent;
  +        apr_pollfd_t pfd;
   
  -        pfd = NULL;
  -        rv = apr_poll_setup(&pfd, 1, p);
  +        pset = NULL;
  +        rv = apr_pollset_create(&pset, 1, p, 0);
           assert(!rv);
  -        rv = apr_poll_socket_add(pfd, sock, APR_POLLOUT);
  +        pfd.p = p;
  +        pfd.desc_type = APR_POLL_SOCKET;
  +        pfd.reqevents = APR_POLLOUT;
  +        pfd.rtnevents = 0;
  +        pfd.desc.s = sock;
  +        pfd.client_data = NULL;
  +
  +        rv = apr_pollset_add(pset, &pfd);        
  +//       rv = apr_poll_socket_add(pfd, sock, APR_POLLOUT);
           assert(!rv);
   
           total_bytes_sent = 0;
  @@ -374,7 +383,7 @@
                   if (APR_STATUS_IS_EAGAIN(rv)) {
                       assert(tmplen == 0);
                       nsocks = 1;
  -                    tmprv = apr_poll(pfd, 1, &nsocks, -1);
  +                    tmprv = apr_pollset_poll(pset, -1, &nsocks, NULL);
                       assert(!tmprv);
                       assert(nsocks == 1);
                       /* continue; */
  
  
  

Mime
View raw message