ASF Bugzilla – Attachment 37017 Details for
Bug 57616
AB - DNS roundrobin support
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
DNS roundrobin patch
ab_dns_pool.diff (text/plain), 2.69 KB, created by
Giovanni Bechis
on 2020-02-15 10:16:43 UTC
(
hide
)
Description:
DNS roundrobin patch
Filename:
MIME Type:
Creator:
Giovanni Bechis
Created:
2020-02-15 10:16:43 UTC
Size:
2.69 KB
patch
obsolete
>Index: support/ab.c >=================================================================== >--- support/ab.c (revision 1873982) >+++ support/ab.c (working copy) >@@ -276,6 +276,12 @@ > apr_interval_time_t time; /* time for connection */ > }; > >+struct sockaddr_pool /* standard linked list */ >+{ >+ apr_sockaddr_t* val; >+ struct sockaddr_pool* next; >+}; >+ > #define ap_min(a,b) (((a)<(b))?(a):(b)) > #define ap_max(a,b) (((a)>(b))?(a):(b)) > #define ap_round_ms(a) ((apr_time_t)((a) + 500)/1000) >@@ -387,6 +393,7 @@ > > apr_sockaddr_t *mysa; > apr_sockaddr_t *destsa; >+struct sockaddr_pool* destsa_pool; > > #ifdef NOT_ASCII > apr_xlate_t *from_ascii, *to_ascii; >@@ -1364,10 +1371,11 @@ > else > apr_pool_create(&c->ctx, cntxt); > >- if ((rv = apr_socket_create(&c->aprsock, destsa->family, >+ if ((rv = apr_socket_create(&c->aprsock, destsa_pool->val->family, > SOCK_STREAM, 0, c->ctx)) != APR_SUCCESS) { > apr_err("socket", rv); > } >+ destsa_pool = destsa_pool->next; > > if (myhost) { > if ((rv = apr_socket_bind(c->aprsock, mysa)) != APR_SUCCESS) { >@@ -1428,7 +1436,7 @@ > c->ssl = NULL; > } > #endif >- if ((rv = apr_socket_connect(c->aprsock, destsa)) != APR_SUCCESS) { >+ if ((rv = apr_socket_connect(c->aprsock, destsa_pool->val)) != APR_SUCCESS) { > if (APR_STATUS_IS_EINPROGRESS(rv)) { > set_conn_state(c, STATE_CONNECTING); > c->rwrite = 0; >@@ -1795,6 +1803,7 @@ > apr_time_t stoptime; > apr_int16_t rtnev; > apr_status_t rv; >+ apr_sockaddr_t *destsa; > int i; > apr_status_t status; > int snprintf_res = 0; >@@ -1949,6 +1958,19 @@ > apr_err(buf, rv); > } > >+ destsa_pool = xmalloc(sizeof(struct sockaddr_pool)); >+ destsa_pool->val = destsa; >+ { >+ struct sockaddr_pool* head = destsa_pool; >+ while(destsa_pool->val->next) >+ { >+ destsa_pool->next = xmalloc(sizeof(struct sockaddr_pool)); >+ destsa_pool->next->val = destsa_pool->val->next; >+ destsa_pool = destsa_pool->next; >+ } >+ destsa_pool->next = head; >+ } >+ > /* ok - lets start */ > start = lasttime = apr_time_now(); > stoptime = tlimit ? (start + apr_time_from_sec(tlimit)) : AB_MAX; >@@ -2029,7 +2051,7 @@ > if (rtnev & APR_POLLOUT) { > if (c->state == STATE_CONNECTING) { > /* call connect() again to detect errors */ >- rv = apr_socket_connect(c->aprsock, destsa); >+ rv = apr_socket_connect(c->aprsock, destsa_pool->val); > if (rv != APR_SUCCESS) { > set_conn_state(c, STATE_UNCONNECTED); > apr_socket_close(c->aprsock);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 57616
:
32504
|
32544
| 37017