From fc852eaada04dc1997d1df746a16dc26615e9d4d Mon Sep 17 00:00:00 2001 From: Mark Riddoch Date: Thu, 20 Jun 2013 10:18:14 +0200 Subject: [PATCH] Changed readconnroute backend structure to simply maintain a pointer to the server rather than include the hostname and port in the backend structure Fix to makefile for routing modules --- modules/include/readconnection.h | 7 +++---- modules/routing/Makefile | 6 +++--- modules/routing/readconnroute.c | 4 +--- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/modules/include/readconnection.h b/modules/include/readconnection.h index a03f9330f..a227a6a6a 100644 --- a/modules/include/readconnection.h +++ b/modules/include/readconnection.h @@ -33,12 +33,11 @@ /** * Internal structure used to define the set of backend servers we are routing - * connections to. + * connections to. This provides the storage for routing module specific data + * that is required for each of the backend servers. */ typedef struct backend { - char *hostname; /**< Server hostname */ - unsigned short port; /**< Port on which the server listens */ - char *protocol; /**< Protocol to use to connect to the server */ + SERVER *server; /**< The server itself */ int count; /**< Number of connections to the server */ } BACKEND; diff --git a/modules/routing/Makefile b/modules/routing/Makefile index 623417793..d3e25f496 100644 --- a/modules/routing/Makefile +++ b/modules/routing/Makefile @@ -25,9 +25,9 @@ TESTSRCS=testroute.c TESTOBJ=$(TESTSRCS:.c=.o) READCONSRCS=readconnroute.c READCONOBJ=$(READCONSRCS:.c=.o) -DEBUGSRCS=debugcli.c -DEBUGCLIOBJ=$(DEBUGSRCS:.c=.o) -SRCS=$(TESTSRCS) $(READCONSRCS) $(DEBUGCLIOBJ) +DEBUGCLISRCS=debugcli.c +DEBUGCLIOBJ=$(DEBUGCLISRCS:.c=.o) +SRCS=$(TESTSRCS) $(READCONSRCS) $(DEBUGCLISRCS) OBJ=$(SRCS:.c=.o) LIBS=-lssl MODULES=libtestroute.so libreadconnroute.so libdebugcli.so diff --git a/modules/routing/readconnroute.c b/modules/routing/readconnroute.c index 863adca7c..b27084a80 100644 --- a/modules/routing/readconnroute.c +++ b/modules/routing/readconnroute.c @@ -147,9 +147,7 @@ int i, n; free(inst); return NULL; } - inst->servers[n]->hostname = strdup(server->name); - inst->servers[n]->protocol = strdup(server->protocol); - inst->servers[n]->port = server->port; + inst->servers[n]->server = server; inst->servers[n]->count = 0; n++; }