diff options
author | venaas <venaas> | 2008-09-23 15:21:50 +0000 |
---|---|---|
committer | venaas <venaas@e88ac4ed-0b26-0410-9574-a7f39faa03bf> | 2008-09-23 15:21:50 +0000 |
commit | 0aa4b1fb04dafb9767309afa5d6ad6805391670f (patch) | |
tree | 49e25fb218817429cc1ae3e89d04e10e3d8f4829 /tcp.c | |
parent | 68d4aae0802ff658cf822976820493627f4948e4 (diff) |
make clientwr not try to connect (left to reader), changed some timing stuff, issue with statusserver and connection down..., added optional cacheexpiry option for tls blocks
git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@398 e88ac4ed-0b26-0410-9574-a7f39faa03bf
Diffstat (limited to 'tcp.c')
-rw-r--r-- | tcp.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -75,6 +75,7 @@ int tcpconnect(struct server *server, struct timeval *when, int timeout, char *t debug(DBG_ERR, "tcpconnect: connecttcp failed"); } debug(DBG_WARN, "tcpconnect: TCP connection to %s port %s up", server->conf->host, server->conf->port); + server->connectionok = 1; gettimeofday(&server->lastconnecttry, NULL); pthread_mutex_unlock(&server->lock); return 1; @@ -150,18 +151,15 @@ unsigned char *radtcpget(int s, int timeout) { int clientradputtcp(struct server *server, unsigned char *rad) { int cnt; size_t len; - struct timeval lastconnecttry; struct clsrvconf *conf = server->conf; - + + if (!server->connectionok) + return 0; len = RADLEN(rad); - lastconnecttry = server->lastconnecttry; - while ((cnt = write(server->sock, rad, len)) <= 0) { + if ((cnt = write(server->sock, rad, len)) <= 0) { debug(DBG_ERR, "clientradputtcp: write error"); - tcpconnect(server, &lastconnecttry, 0, "clientradputtcp"); - lastconnecttry = server->lastconnecttry; + return 0; } - - server->connectionok = 1; debug(DBG_DBG, "clientradputtcp: Sent %d bytes, Radius packet of length %d to TCP peer %s", cnt, len, conf->host); return 1; } |