3 * Copyright (C) Igor Sysoev
7 #ifndef _NGX_HTTP_UPSTREAM_ROUND_ROBIN_H_INCLUDED_
8 #define _NGX_HTTP_UPSTREAM_ROUND_ROBIN_H_INCLUDED_
11 #include <ngx_config.h>
17 struct sockaddr *sockaddr;
21 ngx_int_t current_weight;
30 ngx_uint_t down; /* unsigned down:1; */
33 ngx_ssl_session_t *ssl_session; /* local to a process */
35 } ngx_http_upstream_rr_peer_t;
38 typedef struct ngx_http_upstream_rr_peers_s ngx_http_upstream_rr_peers_t;
40 struct ngx_http_upstream_rr_peers_s {
41 ngx_uint_t single; /* unsigned single:1; */
43 ngx_uint_t last_cached;
45 /* ngx_mutex_t *mutex; */
46 ngx_connection_t **cached;
50 ngx_http_upstream_rr_peers_t *next;
52 ngx_http_upstream_rr_peer_t peer[1];
57 ngx_http_upstream_rr_peers_t *peers;
61 } ngx_http_upstream_rr_peer_data_t;
64 ngx_int_t ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
65 ngx_http_upstream_srv_conf_t *us);
66 ngx_int_t ngx_http_upstream_init_round_robin_peer(ngx_http_request_t *r,
67 ngx_http_upstream_srv_conf_t *us);
68 ngx_int_t ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
69 ngx_http_upstream_resolved_t *ur);
70 ngx_int_t ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc,
72 void ngx_http_upstream_free_round_robin_peer(ngx_peer_connection_t *pc,
73 void *data, ngx_uint_t state);
77 ngx_http_upstream_set_round_robin_peer_session(ngx_peer_connection_t *pc,
79 void ngx_http_upstream_save_round_robin_peer_session(ngx_peer_connection_t *pc,
85 #endif /* _NGX_HTTP_UPSTREAM_ROUND_ROBIN_H_INCLUDED_ */