added round-robin relay url balancing

This commit is contained in:
Roman Arutyunyan 2013-05-13 12:13:11 +04:00
parent db5d361743
commit 244961076f
2 changed files with 6 additions and 4 deletions

View file

@ -446,8 +446,9 @@ ngx_rtmp_relay_create_connection(ngx_rtmp_conf_ctx_t *cctx, ngx_str_t* name,
goto clear;
}
/* use the first address */
addr = target->url.addrs;
/* get address */
addr = &target->url.addrs[target->counter % target->url.naddrs];
target->counter++;
/* copy log to keep shared log unchanged */
rctx->log = *racf->log;

View file

@ -23,8 +23,9 @@ typedef struct {
ngx_int_t start;
ngx_int_t stop;
void *tag; /* usually module reference */
void *data; /* module-specific data */
void *tag; /* usually module reference */
void *data; /* module-specific data */
ngx_uint_t counter; /* mutable connection counter */
} ngx_rtmp_relay_target_t;