Lines 256-261
struct data {
Link Here
|
256 |
apr_interval_time_t time; /* time for connection */ |
256 |
apr_interval_time_t time; /* time for connection */ |
257 |
}; |
257 |
}; |
258 |
|
258 |
|
|
|
259 |
struct sockaddr_pool /* standard linked list */ |
260 |
{ |
261 |
apr_sockaddr_t* val; |
262 |
struct sockaddr_pool* next; |
263 |
}; |
264 |
|
259 |
#define ap_min(a,b) (((a)<(b))?(a):(b)) |
265 |
#define ap_min(a,b) (((a)<(b))?(a):(b)) |
260 |
#define ap_max(a,b) (((a)>(b))?(a):(b)) |
266 |
#define ap_max(a,b) (((a)>(b))?(a):(b)) |
261 |
#define ap_round_ms(a) ((apr_time_t)((a) + 500)/1000) |
267 |
#define ap_round_ms(a) ((apr_time_t)((a) + 500)/1000) |
Lines 357-363
apr_pool_t *cntxt;
Link Here
|
357 |
apr_pollset_t *readbits; |
363 |
apr_pollset_t *readbits; |
358 |
|
364 |
|
359 |
apr_sockaddr_t *mysa; |
365 |
apr_sockaddr_t *mysa; |
360 |
apr_sockaddr_t *destsa; |
366 |
struct sockaddr_pool* destsa_pool; |
361 |
|
367 |
|
362 |
#ifdef NOT_ASCII |
368 |
#ifdef NOT_ASCII |
363 |
apr_xlate_t *from_ascii, *to_ascii; |
369 |
apr_xlate_t *from_ascii, *to_ascii; |
Lines 1235-1244
static void start_connect(struct connection * c)
Link Here
|
1235 |
else |
1241 |
else |
1236 |
apr_pool_create(&c->ctx, cntxt); |
1242 |
apr_pool_create(&c->ctx, cntxt); |
1237 |
|
1243 |
|
1238 |
if ((rv = apr_socket_create(&c->aprsock, destsa->family, |
1244 |
if ((rv = apr_socket_create(&c->aprsock, destsa_pool->val->family, |
1239 |
SOCK_STREAM, 0, c->ctx)) != APR_SUCCESS) { |
1245 |
SOCK_STREAM, 0, c->ctx)) != APR_SUCCESS) { |
1240 |
apr_err("socket", rv); |
1246 |
apr_err("socket", rv); |
1241 |
} |
1247 |
} |
|
|
1248 |
destsa_pool = destsa_pool->next; |
1242 |
|
1249 |
|
1243 |
if (myhost) { |
1250 |
if (myhost) { |
1244 |
if ((rv = apr_socket_bind(c->aprsock, mysa)) != APR_SUCCESS) { |
1251 |
if ((rv = apr_socket_bind(c->aprsock, mysa)) != APR_SUCCESS) { |
Lines 1293-1299
static void start_connect(struct connection * c)
Link Here
|
1293 |
c->ssl = NULL; |
1300 |
c->ssl = NULL; |
1294 |
} |
1301 |
} |
1295 |
#endif |
1302 |
#endif |
1296 |
if ((rv = apr_socket_connect(c->aprsock, destsa)) != APR_SUCCESS) { |
1303 |
if ((rv = apr_socket_connect(c->aprsock, destsa_pool->val)) != APR_SUCCESS) { |
1297 |
if (APR_STATUS_IS_EINPROGRESS(rv)) { |
1304 |
if (APR_STATUS_IS_EINPROGRESS(rv)) { |
1298 |
set_conn_state(c, STATE_CONNECTING); |
1305 |
set_conn_state(c, STATE_CONNECTING); |
1299 |
c->rwrite = 0; |
1306 |
c->rwrite = 0; |
Lines 1630-1635
static void test(void)
Link Here
|
1630 |
int i; |
1637 |
int i; |
1631 |
apr_status_t status; |
1638 |
apr_status_t status; |
1632 |
int snprintf_res = 0; |
1639 |
int snprintf_res = 0; |
|
|
1640 |
apr_sockaddr_t *destsa; |
1633 |
#ifdef NOT_ASCII |
1641 |
#ifdef NOT_ASCII |
1634 |
apr_size_t inbytes_left, outbytes_left; |
1642 |
apr_size_t inbytes_left, outbytes_left; |
1635 |
#endif |
1643 |
#endif |
Lines 1768-1774
static void test(void)
Link Here
|
1768 |
"apr_sockaddr_info_get() for %s", connecthost); |
1776 |
"apr_sockaddr_info_get() for %s", connecthost); |
1769 |
apr_err(buf, rv); |
1777 |
apr_err(buf, rv); |
1770 |
} |
1778 |
} |
1771 |
|
1779 |
destsa_pool = malloc(sizeof(struct sockaddr_pool)); |
|
|
1780 |
destsa_pool->val = destsa; |
1781 |
{ |
1782 |
struct sockaddr_pool* head = destsa_pool; |
1783 |
while(destsa_pool->val->next) |
1784 |
{ |
1785 |
destsa_pool->next = malloc(sizeof(struct sockaddr_pool)); |
1786 |
destsa_pool->next->val = destsa_pool->val->next; |
1787 |
destsa_pool = destsa_pool->next; |
1788 |
} |
1789 |
destsa_pool->next = head; |
1790 |
} |
1772 |
/* ok - lets start */ |
1791 |
/* ok - lets start */ |
1773 |
start = lasttime = apr_time_now(); |
1792 |
start = lasttime = apr_time_now(); |
1774 |
stoptime = tlimit ? (start + apr_time_from_sec(tlimit)) : AB_MAX; |
1793 |
stoptime = tlimit ? (start + apr_time_from_sec(tlimit)) : AB_MAX; |
Lines 1843-1849
static void test(void)
Link Here
|
1843 |
} |
1862 |
} |
1844 |
if (rtnev & APR_POLLOUT) { |
1863 |
if (rtnev & APR_POLLOUT) { |
1845 |
if (c->state == STATE_CONNECTING) { |
1864 |
if (c->state == STATE_CONNECTING) { |
1846 |
rv = apr_socket_connect(c->aprsock, destsa); |
1865 |
rv = apr_socket_connect(c->aprsock, destsa_pool->val); |
1847 |
if (rv != APR_SUCCESS) { |
1866 |
if (rv != APR_SUCCESS) { |
1848 |
set_conn_state(c, STATE_UNCONNECTED); |
1867 |
set_conn_state(c, STATE_UNCONNECTED); |
1849 |
apr_socket_close(c->aprsock); |
1868 |
apr_socket_close(c->aprsock); |
1850 |
- |
|
|