diff options
-rw-r--r-- | test/sendfile.c | 19 | ||||
-rw-r--r-- | test/server.c | 18 |
2 files changed, 28 insertions, 9 deletions
diff --git a/test/sendfile.c b/test/sendfile.c index 34d8315c3..6aff18ad0 100644 --- a/test/sendfile.c +++ b/test/sendfile.c @@ -216,7 +216,7 @@ static int client(client_socket_mode_t socket_mode, char *host) 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 @@ static int client(client_socket_mode_t socket_mode, char *host) 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 @@ static int client(client_socket_mode_t socket_mode, char *host) 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; */ diff --git a/test/server.c b/test/server.c index 5a8268fbe..1101efee9 100644 --- a/test/server.c +++ b/test/server.c @@ -70,7 +70,8 @@ int main(int argc, const char * const argv[]) 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 @@ int main(int argc, const char * const argv[]) 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"); |