comparison src/http/modules/ngx_http_upstream_ip_hash_module.c @ 448:76a79816b771 NGINX_0_7_36

nginx 0.7.36 *) Feature: a preliminary IPv6 support; the "listen" directive of the HTTP module supports IPv6. *) Bugfix: the $ancient_browser variable did not work for browsers preset by a "modern_browser" directives.
author Igor Sysoev <http://sysoev.ru>
date Sat, 21 Feb 2009 00:00:00 +0300
parents 5e3b425174f6
children 6f21ae02fb01
comparison
equal deleted inserted replaced
447:40964c811e59 448:76a79816b771
13 /* the round robin data must be first */ 13 /* the round robin data must be first */
14 ngx_http_upstream_rr_peer_data_t rrp; 14 ngx_http_upstream_rr_peer_data_t rrp;
15 15
16 ngx_uint_t hash; 16 ngx_uint_t hash;
17 17
18 /* AF_INET only */
19 u_char addr[3]; 18 u_char addr[3];
20 19
21 u_char tries; 20 u_char tries;
22 21
23 ngx_event_get_peer_pt get_rr_peer; 22 ngx_event_get_peer_pt get_rr_peer;
109 } 108 }
110 109
111 r->upstream->peer.get = ngx_http_upstream_get_ip_hash_peer; 110 r->upstream->peer.get = ngx_http_upstream_get_ip_hash_peer;
112 111
113 /* AF_INET only */ 112 /* AF_INET only */
114 sin = (struct sockaddr_in *) r->connection->sockaddr; 113
115 p = (u_char *) &sin->sin_addr.s_addr; 114 if (r->connection->sockaddr->sa_family == AF_INET) {
116 iphp->addr[0] = p[0]; 115
117 iphp->addr[1] = p[1]; 116 sin = (struct sockaddr_in *) r->connection->sockaddr;
118 iphp->addr[2] = p[2]; 117 p = (u_char *) &sin->sin_addr.s_addr;
118 iphp->addr[0] = p[0];
119 iphp->addr[1] = p[1];
120 iphp->addr[2] = p[2];
121
122 } else {
123 iphp->addr[0] = 0;
124 iphp->addr[1] = 0;
125 iphp->addr[2] = 0;
126 }
119 127
120 iphp->hash = 89; 128 iphp->hash = 89;
121 iphp->tries = 0; 129 iphp->tries = 0;
122 iphp->get_rr_peer = ngx_http_upstream_get_round_robin_peer; 130 iphp->get_rr_peer = ngx_http_upstream_get_round_robin_peer;
123 131