From c0f3393d4ab923e2eedab0fad88a864e2aae9fc9 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 17 Aug 2009 04:29:47 -0400 Subject: Fix reconnection code Remove redundant reconnection code that was interfeering with the sbus reconnection code. Consolidate include files for sbus relates operations. Make pamsrv code similar to nsssrv code. --- server/responder/nss/nsssrv.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'server/responder/nss') diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c index 456c62929..a896ef31d 100644 --- a/server/responder/nss/nsssrv.c +++ b/server/responder/nss/nsssrv.c @@ -41,7 +41,6 @@ #include "util/btreemap.h" #include "responder/common/responder_packet.h" #include "providers/data_provider.h" -#include "monitor/monitor_sbus.h" #include "monitor/monitor_interfaces.h" #include "sbus/sbus_client.h" @@ -186,35 +185,44 @@ static void nss_shutdown(struct resp_ctx *rctx) exit(0); } +static struct sbus_method nss_dp_methods[] = { + { NULL, NULL } +}; -static void nss_dp_reconnect_init(struct sbus_connection *conn, int status, void *pvt) +struct sbus_interface nss_dp_interface = { + DP_CLI_INTERFACE, + DP_CLI_PATH, + SBUS_DEFAULT_VTABLE, + nss_dp_methods, + NULL +}; + + +static void nss_dp_reconnect_init(struct sbus_connection *conn, + int status, void *pvt) { struct resp_ctx *rctx = talloc_get_type(pvt, struct resp_ctx); + int ret; /* Did we reconnect successfully? */ if (status == SBUS_RECONNECT_SUCCESS) { DEBUG(1, ("Reconnected to the Data Provider.\n")); - return; + + /* Identify ourselves to the data provider */ + ret = dp_common_send_id(conn, + DP_CLI_FRONTEND, + DATA_PROVIDER_VERSION, + "NSS", ""); + /* all fine */ + if (ret == EOK) return; } - /* Handle failure */ + /* Failed to reconnect */ DEBUG(0, ("Could not reconnect to data provider.\n")); /* Kill the backend and let the monitor restart it */ nss_shutdown(rctx); } -static struct sbus_method nss_dp_methods[] = { - { NULL, NULL } -}; - -struct sbus_interface nss_dp_interface = { - DP_CLI_INTERFACE, - DP_CLI_PATH, - SBUS_DEFAULT_VTABLE, - nss_dp_methods, - NULL -}; - int nss_process_init(TALLOC_CTX *mem_ctx, struct tevent_context *ev, struct confdb_ctx *cdb) -- cgit