summaryrefslogtreecommitdiffstats
path: root/server/providers
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2009-01-14 15:52:48 -0500
committerSimo Sorce <idra@samba.org>2009-01-14 15:52:48 -0500
commitf52c3c6a93f673ba422f5eee1788e2f5b70b3a6a (patch)
treece9816cc678402cd90d796ffeca6e273de7fd487 /server/providers
parent2a729edfe36c7519c48b9b4225fc84be6775da08 (diff)
downloadsssd-f52c3c6a93f673ba422f5eee1788e2f5b70b3a6a.tar.gz
sssd-f52c3c6a93f673ba422f5eee1788e2f5b70b3a6a.tar.xz
sssd-f52c3c6a93f673ba422f5eee1788e2f5b70b3a6a.zip
Add code to make it easier to reconnect in case the server
is not available immediately or drops the dbus connection. First step is the nss connection to the data provider.
Diffstat (limited to 'server/providers')
-rw-r--r--server/providers/data_provider.h2
-rw-r--r--server/providers/data_provider_be.c18
-rw-r--r--server/providers/dp_helpers.c10
3 files changed, 15 insertions, 15 deletions
diff --git a/server/providers/data_provider.h b/server/providers/data_provider.h
index bd610a539..a7311e5ee 100644
--- a/server/providers/data_provider.h
+++ b/server/providers/data_provider.h
@@ -77,6 +77,8 @@ int dp_sbus_cli_init(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct confdb_ctx *cdb,
struct sbus_method *methods,
+ void *conn_pvt_data,
+ sbus_conn_destructor_fn destructor,
struct service_sbus_ctx **srvs_ctx);
#endif /* __DATA_PROVIDER_ */
diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c
index 75e99bdc5..ba9ea466c 100644
--- a/server/providers/data_provider_be.c
+++ b/server/providers/data_provider_be.c
@@ -308,21 +308,9 @@ static int mon_cli_init(struct be_ctx *ctx)
* sbus channel to the data provider daemon */
static int be_cli_init(struct be_ctx *ctx)
{
- struct service_sbus_ctx *dp_ctx;
- int ret;
-
- ret = dp_sbus_cli_init(ctx, ctx->ev, ctx->cdb,
- be_methods, &dp_ctx);
- if (ret != EOK) {
- return ret;
- }
-
- ctx->dp_ctx = dp_ctx;
-
- /* attach be context to the connection */
- sbus_conn_set_private_data(dp_ctx->scon_ctx, ctx);
-
- return EOK;
+ return dp_sbus_cli_init(ctx, ctx->ev, ctx->cdb,
+ be_methods, ctx, NULL,
+ &ctx->dp_ctx);
}
static int load_backend(struct be_ctx *ctx)
diff --git a/server/providers/dp_helpers.c b/server/providers/dp_helpers.c
index 99d65f45e..52dc69e18 100644
--- a/server/providers/dp_helpers.c
+++ b/server/providers/dp_helpers.c
@@ -25,6 +25,8 @@ int dp_sbus_cli_init(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct confdb_ctx *cdb,
struct sbus_method *methods,
+ void *conn_pvt_data,
+ sbus_conn_destructor_fn destructor,
struct service_sbus_ctx **srvs_ctx)
{
struct service_sbus_ctx *ss_ctx;
@@ -87,6 +89,14 @@ int dp_sbus_cli_init(TALLOC_CTX *mem_ctx,
sm_ctx->message_handler = sbus_message_handler;
sbus_conn_add_method_ctx(ss_ctx->scon_ctx, sm_ctx);
+ if (conn_pvt_data) {
+ sbus_conn_set_private_data(ss_ctx->scon_ctx, conn_pvt_data);
+ }
+
+ if (destructor) {
+ sbus_conn_set_destructor(ss_ctx->scon_ctx, destructor);
+ }
+
talloc_steal(mem_ctx, ss_ctx);
*srvs_ctx = ss_ctx;
ret = EOK;