From faace4bdd6b84f60d2f707c00d31a84c0e84d375 Mon Sep 17 00:00:00 2001 From: eindenbom Date: Thu, 17 Jun 2010 16:09:36 +0400 Subject: Added an interface to query number of configured (and currently resolved through SRV records) failover servers. --- src/providers/data_provider_fo.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/providers/data_provider_fo.c') diff --git a/src/providers/data_provider_fo.c b/src/providers/data_provider_fo.c index 1654e222..21059d39 100644 --- a/src/providers/data_provider_fo.c +++ b/src/providers/data_provider_fo.c @@ -277,6 +277,27 @@ int be_fo_add_srv_server(struct be_ctx *ctx, const char *service_name, return EOK; } +int be_fo_get_server_count(struct be_ctx *ctx, const char *service_name) +{ + struct be_svc_data *svc_data; + + if (!ctx->be_fo) { + return 0; + } + + DLIST_FOR_EACH(svc_data, ctx->be_fo->svcs) { + if (strcmp(svc_data->name, service_name) == 0) { + break; + } + } + + if (!svc_data) { + return 0; + } + + return fo_get_server_count(svc_data->fo_service); +} + int be_fo_add_server(struct be_ctx *ctx, const char *service_name, const char *server, int port, void *user_data) { -- cgit