summaryrefslogtreecommitdiff
path: root/tcp.c
diff options
context:
space:
mode:
authorvenaas <venaas>2008-12-18 15:14:00 +0000
committervenaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf>2008-12-18 15:14:00 +0000
commit3c779c1093a5cb6314bc366c6135fb2eaac8cdeb (patch)
tree0ba9c4f9ebdb9a91bee68c286abc9c1e6b66a286 /tcp.c
parentdfb9fcfbba3e196b4c082cc9b8a1fe7b80ac8564 (diff)
cleaning up code
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@441 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'tcp.c')
-rw-r--r--tcp.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tcp.c b/tcp.c
index ac10d48..c70a9b2 100644
--- a/tcp.c
+++ b/tcp.c
@@ -31,6 +31,13 @@
#include "radsecproxy.h"
#include "tcp.h"
+static struct addrinfo *srcres = NULL;
+
+void tcpsetsrcres(char *source) {
+ if (!srcres)
+ srcres = resolve_hostport_addrinfo(RAD_TCP, source);
+}
+
int tcpconnect(struct server *server, struct timeval *when, int timeout, char *text) {
struct timeval now;
time_t elapsed;
@@ -70,7 +77,7 @@ int tcpconnect(struct server *server, struct timeval *when, int timeout, char *t
debug(DBG_WARN, "tcpconnect: trying to open TCP connection to %s port %s", server->conf->host, server->conf->port);
if (server->sock >= 0)
close(server->sock);
- if ((server->sock = connecttcp(server->conf->addrinfo, getsrcprotores(RAD_TCP))) >= 0)
+ if ((server->sock = connecttcp(server->conf->addrinfo, srcres)) >= 0)
break;
debug(DBG_ERR, "tcpconnect: connecttcp failed");
}