View | Details | Raw Unified | Return to bug 57616
Collapse All | Expand All

(-)support/ab.c (-3 / +25 lines)
Lines 276-281 Link Here
276
    apr_interval_time_t time;     /* time for connection */
276
    apr_interval_time_t time;     /* time for connection */
277
};
277
};
278
278
279
struct sockaddr_pool              /* standard linked list */
280
{
281
    apr_sockaddr_t* val;
282
    struct sockaddr_pool* next;
283
};
284
279
#define ap_min(a,b) (((a)<(b))?(a):(b))
285
#define ap_min(a,b) (((a)<(b))?(a):(b))
280
#define ap_max(a,b) (((a)>(b))?(a):(b))
286
#define ap_max(a,b) (((a)>(b))?(a):(b))
281
#define ap_round_ms(a) ((apr_time_t)((a) + 500)/1000)
287
#define ap_round_ms(a) ((apr_time_t)((a) + 500)/1000)
Lines 387-392 Link Here
387
393
388
apr_sockaddr_t *mysa;
394
apr_sockaddr_t *mysa;
389
apr_sockaddr_t *destsa;
395
apr_sockaddr_t *destsa;
396
struct sockaddr_pool* destsa_pool;
390
397
391
#ifdef NOT_ASCII
398
#ifdef NOT_ASCII
392
apr_xlate_t *from_ascii, *to_ascii;
399
apr_xlate_t *from_ascii, *to_ascii;
Lines 1364-1373 Link Here
1364
    else
1371
    else
1365
        apr_pool_create(&c->ctx, cntxt);
1372
        apr_pool_create(&c->ctx, cntxt);
1366
1373
1367
    if ((rv = apr_socket_create(&c->aprsock, destsa->family,
1374
    if ((rv = apr_socket_create(&c->aprsock, destsa_pool->val->family,
1368
                SOCK_STREAM, 0, c->ctx)) != APR_SUCCESS) {
1375
                SOCK_STREAM, 0, c->ctx)) != APR_SUCCESS) {
1369
    apr_err("socket", rv);
1376
    apr_err("socket", rv);
1370
    }
1377
    }
1378
    destsa_pool = destsa_pool->next;
1371
1379
1372
    if (myhost) {
1380
    if (myhost) {
1373
        if ((rv = apr_socket_bind(c->aprsock, mysa)) != APR_SUCCESS) {
1381
        if ((rv = apr_socket_bind(c->aprsock, mysa)) != APR_SUCCESS) {
Lines 1428-1434 Link Here
1428
        c->ssl = NULL;
1436
        c->ssl = NULL;
1429
    }
1437
    }
1430
#endif
1438
#endif
1431
    if ((rv = apr_socket_connect(c->aprsock, destsa)) != APR_SUCCESS) {
1439
    if ((rv = apr_socket_connect(c->aprsock, destsa_pool->val)) != APR_SUCCESS) {
1432
        if (APR_STATUS_IS_EINPROGRESS(rv)) {
1440
        if (APR_STATUS_IS_EINPROGRESS(rv)) {
1433
            set_conn_state(c, STATE_CONNECTING);
1441
            set_conn_state(c, STATE_CONNECTING);
1434
            c->rwrite = 0;
1442
            c->rwrite = 0;
Lines 1795-1800 Link Here
1795
    apr_time_t stoptime;
1803
    apr_time_t stoptime;
1796
    apr_int16_t rtnev;
1804
    apr_int16_t rtnev;
1797
    apr_status_t rv;
1805
    apr_status_t rv;
1806
    apr_sockaddr_t *destsa;
1798
    int i;
1807
    int i;
1799
    apr_status_t status;
1808
    apr_status_t status;
1800
    int snprintf_res = 0;
1809
    int snprintf_res = 0;
Lines 1949-1954 Link Here
1949
        apr_err(buf, rv);
1958
        apr_err(buf, rv);
1950
    }
1959
    }
1951
1960
1961
    destsa_pool = xmalloc(sizeof(struct sockaddr_pool));
1962
    destsa_pool->val = destsa;
1963
    {
1964
        struct sockaddr_pool* head = destsa_pool;
1965
        while(destsa_pool->val->next)
1966
        {
1967
            destsa_pool->next = xmalloc(sizeof(struct sockaddr_pool));
1968
            destsa_pool->next->val = destsa_pool->val->next;
1969
            destsa_pool = destsa_pool->next;
1970
        }
1971
        destsa_pool->next = head;
1972
    }
1973
1952
    /* ok - lets start */
1974
    /* ok - lets start */
1953
    start = lasttime = apr_time_now();
1975
    start = lasttime = apr_time_now();
1954
    stoptime = tlimit ? (start + apr_time_from_sec(tlimit)) : AB_MAX;
1976
    stoptime = tlimit ? (start + apr_time_from_sec(tlimit)) : AB_MAX;
Lines 2029-2035 Link Here
2029
            if (rtnev & APR_POLLOUT) {
2051
            if (rtnev & APR_POLLOUT) {
2030
                if (c->state == STATE_CONNECTING) {
2052
                if (c->state == STATE_CONNECTING) {
2031
                    /* call connect() again to detect errors */
2053
                    /* call connect() again to detect errors */
2032
                    rv = apr_socket_connect(c->aprsock, destsa);
2054
                    rv = apr_socket_connect(c->aprsock, destsa_pool->val);
2033
                    if (rv != APR_SUCCESS) {
2055
                    if (rv != APR_SUCCESS) {
2034
                        set_conn_state(c, STATE_UNCONNECTED);
2056
                        set_conn_state(c, STATE_UNCONNECTED);
2035
                        apr_socket_close(c->aprsock);
2057
                        apr_socket_close(c->aprsock);

Return to bug 57616