diff options
author | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2017-01-17 20:00:00 +0300 |
commit | 16cbf3c076a0aca6d47adaf3f719493674cf2363 (patch) | |
tree | e6530480020f62a2bdbf249988ec3e2a751d3927 /src/nxt_upstream.c | |
download | unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.gz unit-16cbf3c076a0aca6d47adaf3f719493674cf2363.tar.bz2 |
Initial version.
Diffstat (limited to 'src/nxt_upstream.c')
-rw-r--r-- | src/nxt_upstream.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/nxt_upstream.c b/src/nxt_upstream.c new file mode 100644 index 00000000..e1615120 --- /dev/null +++ b/src/nxt_upstream.c @@ -0,0 +1,43 @@ + +/* + * Copyright (C) Igor Sysoev + * Copyright (C) NGINX, Inc. + */ + +#include <nxt_main.h> + + +typedef struct { + void (*peer_get)(nxt_upstream_peer_t *up); + void (*peer_free)(nxt_upstream_peer_t *up); +} nxt_upstream_name_t; + + +static const nxt_upstream_name_t nxt_upstream_names[] = { + + { "round_robin", &nxt_upstream_round_robin }, +}; + + +void +nxt_upstream_create(nxt_upstream_peer_t *up) +{ + /* TODO: dynamic balancer add & lvlhsh */ + nxt_upstream_names[0].create(up); +} + + +void +nxt_upstream_peer(nxt_upstream_peer_t *up) +{ + nxt_upstream_t *u; + + u = up->upstream; + + if (u != NULL) { + u->peer_get(up); + return; + } + + nxt_upstream_create(up); +} |