summaryrefslogtreecommitdiff
path: root/server/providers
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2009-08-05 05:44:20 -0400
committerStephen Gallagher <sgallagh@redhat.com>2009-08-10 09:42:19 -0400
commitf1e4471551aa74015579bff0b64735cc9b085b74 (patch)
tree45071c03d3f4810e8214a9097c36b21641d9cfc3 /server/providers
parent0c7050d8569ce7ee61b13d02b4733249a11e171f (diff)
downloadsssd-f1e4471551aa74015579bff0b64735cc9b085b74.tar.gz
sssd-f1e4471551aa74015579bff0b64735cc9b085b74.tar.bz2
sssd-f1e4471551aa74015579bff0b64735cc9b085b74.zip
merge server and connection structures
This reduce code duplication as it allows to use one set of watch and timeout functions, and at the same time also allow not to use a secondary structure just to unify these functions.
Diffstat (limited to 'server/providers')
-rw-r--r--server/providers/data_provider.c20
-rw-r--r--server/providers/data_provider_be.c14
2 files changed, 9 insertions, 25 deletions
diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c
index 29bfe946..c844f644 100644
--- a/server/providers/data_provider.c
+++ b/server/providers/data_provider.c
@@ -55,7 +55,7 @@ struct dp_frontend;
struct dp_ctx {
struct tevent_context *ev;
struct confdb_ctx *cdb;
- struct sbus_srv_ctx *sbus_srv;
+ struct sbus_connection *sbus_srv;
struct dp_backend *be_list;
struct dp_frontend *fe_list;
};
@@ -212,14 +212,8 @@ static int dp_monitor_init(struct dp_ctx *dpctx)
return ret;
}
- /* FIXME: remove this */
- if (talloc_reference(dpctx, sm_ctx) == NULL) {
- DEBUG(0, ("Failed to take memory reference\n"));
- return ENOMEM;
- }
-
- ret = sbus_client_init(dpctx, dpctx->ev, sm_ctx,
- sbus_address, &conn,
+ ret = sbus_client_init(dpctx, dpctx->ev, sbus_address,
+ sm_ctx, &conn,
NULL, NULL);
if (ret != EOK) {
DEBUG(0, ("Failed to connect to monitor services.\n"));
@@ -997,7 +991,6 @@ static int dp_frontend_destructor(void *ctx)
static int dp_srv_init(struct dp_ctx *dpctx)
{
TALLOC_CTX *tmp_ctx;
- struct sbus_srv_ctx *sbus_srv;
struct sbus_method_ctx *sd_ctx;
char *dpbus_address;
char *default_dp_address;
@@ -1041,14 +1034,11 @@ static int dp_srv_init(struct dp_ctx *dpctx)
sd_ctx->methods = dp_sbus_methods;
sd_ctx->message_handler = sbus_message_handler;
- ret = sbus_new_server(dpctx,
- dpctx->ev, sd_ctx,
- &sbus_srv, dpbus_address,
- dbus_dp_init, dpctx);
+ ret = sbus_new_server(dpctx, dpctx->ev, dpbus_address, sd_ctx,
+ &dpctx->sbus_srv, dbus_dp_init, dpctx);
if (ret != EOK) {
goto done;
}
- dpctx->sbus_srv = sbus_srv;
talloc_steal(dpctx, sd_ctx);
done:
diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c
index 7db2047f..ecd20ad9 100644
--- a/server/providers/data_provider_be.c
+++ b/server/providers/data_provider_be.c
@@ -693,8 +693,8 @@ static int mon_cli_init(struct be_ctx *ctx)
return ENOMEM;
}
- ret = sbus_client_init(ctx, ctx->ev, ctx->mon_sm_ctx,
- sbus_address, &ctx->mon_conn,
+ ret = sbus_client_init(ctx, ctx->ev, sbus_address,
+ ctx->mon_sm_ctx, &ctx->mon_conn,
NULL, ctx);
if (ret != EOK) {
DEBUG(0, ("Failed to connect to monitor services.\n"));
@@ -726,14 +726,8 @@ static int be_cli_init(struct be_ctx *ctx)
return ret;
}
- /* FIXME: remove this */
- if (talloc_reference(ctx, ctx->dp_sm_ctx) == NULL) {
- DEBUG(0, ("Failed to take memory reference\n"));
- return ENOMEM;
- }
-
- ret = sbus_client_init(ctx, ctx->ev, ctx->dp_sm_ctx,
- sbus_address, &ctx->dp_conn,
+ ret = sbus_client_init(ctx, ctx->ev, sbus_address,
+ ctx->dp_sm_ctx, &ctx->dp_conn,
NULL, ctx);
if (ret != EOK) {
DEBUG(0, ("Failed to connect to monitor services.\n"));