commit 0b32923d8cfcb2d7d8ceda5af8db53cdb6403f67 parent 25374c44cdd269eda3c4a2674adef154752acae8 Author: finwo <finwo@pm.me> Date: Sat, 3 Jan 2026 19:31:04 +0100 1.30 Diffstat:
103 files changed, 259 insertions(+), 178 deletions(-)
diff --git a/ChangeLog b/ChangeLog @@ -1,6 +1,13 @@ ChangeLog for Crossroads ------------------------------------------------------------------------------ +1.30 [KK 2007-03-20] Signed/unsigned fix in net_read() (return value < + 0 would get evaluated badly when taken as unsigned). Changed + state/string handling, so that "up" is a synonym for "available" + (eg. in "crossroads tell {myservice} {mybackend} up"). Fixed up + sources so that compilation with -pedantic is OK. Added flag -W + to warn against loads of things, mainly signed/unsigned comparisons. + 1.29 [KK 2007-02-25] Small code changes in error/msg/warning, no action when no format string. [KK 2007-03-07] fork_tcp_servicer() won't abort upon fork diff --git a/doc/crossroads.html b/doc/crossroads.html @@ -1,12 +1,12 @@ <a name="defs.yo"></a><html><head> -<title>Crossroads 1.29</title> +<title>Crossroads 1.30</title> <link rel="stylesheet" type="text/css" href="http://www.e-tunity.com/css/yodl.css"> <link rel="stylesheet" type="text/css" href="http://www.e-tunity.com/css/yodl.css"> <link rev="made" href="mailto:info@e-tunity.com"> </head> <body> <hr> -<h1>Crossroads 1.29</h1> +<h1>Crossroads 1.30</h1> <h2>Karel Kubat</h2> <h2>e-tunity</h2><h2>2005, 2006, ff.</h2> diff --git a/doc/crossroads.man b/doc/crossroads.man @@ -1,6 +1,6 @@ -.TH "Crossroads 1\&.29" "2005, 2006, ff\&." +.TH "Crossroads 1\&.30" "2005, 2006, ff\&." .PP -.SH "Crossroads 1\&.29" +.SH "Crossroads 1\&.30" .SH "Karel Kubat" .SH "e-tunity" .SH "2005, 2006, ff\&." diff --git a/doc/crossroads.pdf b/doc/crossroads.pdf Binary files differ. diff --git a/etc/Makefile.def b/etc/Makefile.def @@ -3,7 +3,7 @@ # Versioning. This defines the overall version ID and must match the topmost # entry in the ChangeLog. -VER = 1.29 +VER = 1.30 # Default config DEFAULT_CONF = /etc/crossroads.conf diff --git a/src/Makefile b/src/Makefile @@ -61,7 +61,7 @@ lexer.o: lexer.c $(CC) $(DEFS) -c -g $< %.o: %.c - $(CC) $(DEFS) -c -g -Wall $< + $(CC) $(DEFS) -c -g -W -Wall $< crossroads: libcrossroads.a $(CC) $(EXTRALIBS) -g -L. -lcrossroads $(LIBS) -o $@ -lm diff --git a/src/allocreporter.c b/src/allocreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/ansistamp.c b/src/ansistamp.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/backendavailable.c b/src/backendavailable.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/backendconnect.c b/src/backendconnect.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/backendcount.c b/src/backendcount.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/choosebackend.c b/src/choosebackend.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -9,7 +9,7 @@ void choose_backend () { int backends[MAX_BACKEND], nbackends = 0, i, j, k, target_set = 0, flat_weights = 1, weights[MAX_BACKEND], *sel_weights, tot_weights, lo_val, hi_val, done; - unsigned long long values[MAX_BACKEND], nbest; + double values [MAX_BACKEND], nbest; unsigned nclients; char *exthandler; FILE *f; diff --git a/src/configtest.c b/src/configtest.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/copysockets.c b/src/copysockets.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/createcommandlinespace.c b/src/createcommandlinespace.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/crossroads.h b/src/crossroads.h @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -89,7 +89,7 @@ typedef enum { /* Config parsing related */ cf_denyfromspec, cf_allowfilespec, cf_denyfilespec, - cf_useraccountspec, + cf_useraccountspec } Conftype; typedef union { /* Integer of string value */ @@ -114,12 +114,12 @@ typedef enum { /* Dispatching types */ ds_byduration, ds_byorder, ds_byconnections, - ds_externalhandler, + ds_externalhandler } Dispatchtype; typedef enum { /* Service types */ type_any, - type_http, + type_http } Servicetype; typedef struct { /* Backend description */ @@ -134,7 +134,7 @@ typedef struct { /* Backend description */ char *onend; /* .. or on ending */ char *dumpfile; /* .. traffic dump file */ char *thruputfile; /* .. traffic throughput file */ - int maxconnections; /* .. max # of allowed connections */ + unsigned maxconnections; /* .. max # of allowed connections */ char *stickycookie; /* .. cookie selector */ char **addclientheader; /* .. client hdrs to ADD */ int naddclientheader; /* .. table size */ @@ -187,14 +187,14 @@ typedef enum { /* Backend availability */ st_down, /* .. permanently unavailable */\ st_waking, /* .. scheduled for wake up */ st_intermediate, /* .. bogus, for mark_activity() */ - st_unknown, /* .. no idea (terminator) */ + st_unknown /* .. no idea (terminator) */ } Backendavail; typedef struct { /* Backend state */ Backendavail avail; /* .. availability */ unsigned long totuses; /* .. times hit */ unsigned long failures; /* .. times failed */ - unsigned long long nbytes; /* .. transferred bytes */ + double nbytes; /* .. transferred bytes */ unsigned long sessions; /* .. # of http sessions */ unsigned long avg_nbytes; /* .. averaged over # connections */ double nsec; /* .. connection durations */ @@ -205,7 +205,7 @@ typedef struct { /* Backend state */ typedef struct { /* Service reporting (shmem) */ int pid; /* .. PID of service daemon */ int rev_pid; /* .. PID of revival handler */ - int nclients; /* .. active clients */ + unsigned nclients; /* .. active clients */ int last_backend; /* .. last used back end */ Backendstate /* .. states of the back ends */ backendstate[MAX_BACKEND]; @@ -215,7 +215,7 @@ typedef enum { /* Stage of the program: */ stage_main, /* .. commandline */ stage_waiting, /* .. waiting for connections */ stage_serving, /* .. servicing a connection */ - stage_retrying, /* .. waking up a backend */ + stage_retrying /* .. waking up a backend */ } Programstage; /* Update stagetostring.c when */ /* modifying! */ @@ -226,20 +226,25 @@ typedef struct { /* An HTTP Message */ typedef enum { /* Time representation format */ tm_localtime, /* .. local */ - tm_gmtime, /* .. UTC */ + tm_gmtime /* .. UTC */ } TmType; typedef enum { /* TCP copying direction */ dir_client_to_server, - dir_server_to_client, + dir_server_to_client } CopyDirection; typedef enum { /* HTTP version */ con_unknown, con_keepalive, - con_close, + con_close } HttpConnectionType; +typedef struct { /* Numeric state to string map */ + Backendavail av; + char *nm; +} StateStringMap; + /* Globals. */ #ifndef EXTERN #define EXTERN extern @@ -272,7 +277,8 @@ EXTERN Servicereport *servicereport; /* reporter in shared mem */ EXTERN int sloppyportbind; /* -s flag present */ EXTERN unsigned char *srbuf; /* server socket input buffer */ EXTERN unsigned srbufpos, srbufmax; /* .. position & bytes */ -EXTERN char *state_to_string_map[]; /* backend states as strings */ +EXTERN StateStringMap /* state/string map */ + statestringmap[]; /* .. and vv */ EXTERN int uid_org, uid_set; /* original uid, flag: changed? */ EXTERN FILE *yyin; /* config file handle */ EXTERN int yylineno; /* input line number */ @@ -331,9 +337,7 @@ extern void log_activity_start (void); extern void log_activity_end (void); extern void log_activity_continuation (void); extern int make_socket (int port, char const *ipaddr); -extern void mark_activity (unsigned long long nbytes, - double nsec, - Backendavail newstate); +extern void mark_activity (double nbytes, double nsec, Backendavail newstate); extern void msg (char const *fmt, ...); extern void msgdumpbuf (unsigned char const *buf, int buflen); extern unsigned net_copy (int clientsock, int serversock, unsigned maxbytes, @@ -343,8 +347,8 @@ extern unsigned net_read (int sock, unsigned maxbytes, unsigned char *buf, extern unsigned char *net_buffer (CopyDirection dir, unsigned *sz); extern unsigned char *net_bufread (int sock, unsigned maxbytes, unsigned *nreadp, int is_client); -extern int net_write (int sock, unsigned char const *buf, unsigned len, - int is_client); +extern unsigned net_write (int sock, unsigned char const *buf, unsigned len, + int is_client); extern int restart (int ac, char **av); extern void runservice (void); extern int serve (int ac, char **av); diff --git a/src/deallocreporter.c b/src/deallocreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/decrclientcount.c b/src/decrclientcount.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/error.c b/src/error.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/forktcpservicer.c b/src/forktcpservicer.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpcopy.c b/src/httpcopy.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -39,12 +39,13 @@ unsigned getchunk (int sock, int dest, CopyDirection dir) { * chunk size */ while (1) { cp = net_bufread (sock, 1, 0, dir == dir_client_to_server); - // msg ("Got character %c (%d) while scanning chunk size", *cp, *cp); + /* msg ("Got character %c (%d) while scanning chunk size", + *cp, *cp); */ net_write (dest, cp, 1, dir == dir_client_to_server); if (*cp == '\n') { sscanf (hexbuf, "%x", &ret); free (hexbuf); - // msg ("Got chunk size 0x%x (%d)", ret, ret); + /* msg ("Got chunk size 0x%x (%d)", ret, ret); */ return (ret); } if (in_number) { diff --git a/src/httperror.c b/src/httperror.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpheaderaddheader.c b/src/httpheaderaddheader.c @@ -1,11 +1,12 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ + #include "crossroads.h" -// #define DEBUG +/* #define DEBUG */ #ifdef DEBUG static void debughdr (HttpHeader *h) { diff --git a/src/httpheaderappendheader.c b/src/httpheaderappendheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -24,7 +24,9 @@ void http_header_appendheader (HttpHeader *m, char const *h) { for (i = 0; i < m->nheader; i++) { if (!m->header[i] || !*m->header[i]) continue; - // msg ("Append header: comparing '%s' to '%s'", hname, m->header[i]); + /* msg ("Append header: comparing '%s' to '%s'", + hname, m->header[i]); */ + if (!strncasecmp (m->header[i], hname, strlen(hname))) { m->header[i] = xstrcat (m->header[i], "; "); m->header[i] = xstrcat (m->header[i], exp); diff --git a/src/httpheaderconnectiontype.c b/src/httpheaderconnectiontype.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpheaderfree.c b/src/httpheaderfree.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpheaderhascookie.c b/src/httpheaderhascookie.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpheaderhttpver.c b/src/httpheaderhttpver.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpheadernew.c b/src/httpheadernew.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpheaderread.c b/src/httpheaderread.c @@ -1,11 +1,12 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ + #include "crossroads.h" -// #define DEBUG +/* #define DEBUG */ #ifdef DEBUG static void debughdr (HttpHeader *h) { @@ -30,8 +31,8 @@ void http_header_read (HttpHeader *h, int sock, CopyDirection dir) { dir == dir_client_to_server ? "client" : "server"); while (1) { cp = net_bufread (sock, 1, 0, dir == dir_client_to_server); - // msg ("http header read: got char %d (%c)", *cp, *cp); - // SHOWHEADERS(h); + /* msg ("http header read: got char %d (%c)", *cp, *cp); */ + /* SHOWHEADERS(h); */ if (*cp == '\r') continue; if (*cp == '\n') { diff --git a/src/httpheaderremoveheader.c b/src/httpheaderremoveheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpheadersetheader.c b/src/httpheadersetheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpheaderval.c b/src/httpheaderval.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -11,7 +11,7 @@ unsigned char const *http_header_val (HttpHeader *m, char const *what) { int i; for (i = 0; i < m->nheader; i++) { - // msg ("Scanning header %s for %s", m->header[i], what); + /* msg ("Scanning header %s for %s", m->header[i], what); */ if (m->header[i] && !strncasecmp (m->header[i], what, strlen(what))) { ret = (unsigned char const *) m->header[i] + strlen(what); if (*ret == ':') { diff --git a/src/httpheaderwrite.c b/src/httpheaderwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpinsertheader.c b/src/httpinsertheader.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpserve.c b/src/httpserve.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpserversocket.c b/src/httpserversocket.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/httpwrite.c b/src/httpwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -7,7 +7,7 @@ int http_write (int sock, CopyDirection dir, unsigned char const *buf, unsigned buflen) { - int nwritten, totwritten = 0; + unsigned nwritten, totwritten = 0; while (totwritten < buflen) { nwritten = net_write (sock, buf + totwritten, buflen - totwritten, diff --git a/src/incrclientcount.c b/src/incrclientcount.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/initsockaddr.c b/src/initsockaddr.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/interrupt.c b/src/interrupt.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/ipfaddallow.c b/src/ipfaddallow.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/ipfadddeny.c b/src/ipfadddeny.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/ipfallowed.c b/src/ipfallowed.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/ipfdenied.c b/src/ipfdenied.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/ipfloadfile.c b/src/ipfloadfile.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/ipfmatch.c b/src/ipfmatch.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/ipfparse.c b/src/ipfparse.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/ishexdigit.c b/src/ishexdigit.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/isspace.c b/src/isspace.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lexer.c b/src/lexer.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/lockreporter.c b/src/lockreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/logactivityany.c b/src/logactivityany.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/logactivitycontinuation.c b/src/logactivitycontinuation.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/logactivityend.c b/src/logactivityend.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/logactivitystart.c b/src/logactivitystart.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/main.c b/src/main.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -11,14 +11,15 @@ int log_facility = LOG_DAEMON; -char *state_to_string_map [] = { /* backend states as strings */ - "available", - "UNAVAILABLE", - "DOWN", - "waking", - "intermediate update", - "unknown", - 0, +StateStringMap statestringmap[] = { + { st_available, "available" }, + { st_available, "up" }, + { st_unavailable, "UNAVAILABLE" }, + { st_down, "DOWN" }, + { st_waking, "WAKING" }, + { st_intermediate, "INTERMEDIATE" }, + { st_unknown, "UNKNOWN" }, + { st_unknown, 0 } }; int relevant_sigs[] = { /* signals relevant to this app */ @@ -40,9 +41,10 @@ typedef struct { } Handler; int main (int argc, char **argv) { - int opt, i; + int opt; + unsigned i; static Handler handler[] = { - // Argument Nr.args Needconf Handler function + /* Argument Nr.args Needconf Handler function */ { "services", 0, 1, show_services }, { "status", 0, 1, show_status }, { "stop", 0, 1, stop_daemon }, diff --git a/src/makesocket.c b/src/makesocket.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/markactivity.c b/src/markactivity.c @@ -1,14 +1,14 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ #include "crossroads.h" -void mark_activity (unsigned long long nbytes, double nsec, +void mark_activity (double nbytes, double nsec, Backendavail newstate) { - unsigned long long llval; + double llval; double dlval; unsigned multiplier; int i; diff --git a/src/msg.c b/src/msg.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/msgdumpbuf.c b/src/msgdumpbuf.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/netbuffer.c b/src/netbuffer.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/netbufread.c b/src/netbufread.c @@ -1,12 +1,13 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ + #include "crossroads.h" unsigned char *net_bufread (int sock, unsigned max, unsigned *nread, - int is_client) { + int is_client) { unsigned char *buf; unsigned *bufpos, *bufmax, rest; unsigned char *ret; diff --git a/src/netcopy.c b/src/netcopy.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -9,7 +9,7 @@ unsigned net_copy (int cl, int sr, unsigned max, unsigned char *buf) { fd_set readset, exset; struct timeval tv, *tvp, tv1, tv2; int nfd; - unsigned nread, nwritten, totwritten; + int nread, nwritten, totwritten; CopyDirection dir; double microsec; diff --git a/src/netread.c b/src/netread.c @@ -1,15 +1,16 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ + #include "crossroads.h" unsigned net_read (int sock, unsigned max, unsigned char *buf, int is_client) { fd_set readset, exset; struct timeval tv, *tvp, tv1, tv2; int nfd; - unsigned nread; + int nread; CopyDirection dir; double microsec; char *desc; @@ -60,8 +61,8 @@ unsigned net_read (int sock, unsigned max, unsigned char *buf, int is_client) { log_activity_end(); if (nread < 0) { mark_activity (0, 0, is_client ? st_available : st_unavailable); - error ("Service %s: read error when getting data from %s", - activeservice->name, desc); + error ("Service %s: read error when getting data from %s: %s", + activeservice->name, desc, strerror(errno)); } else { msg ("Service %s: %s signals end of data", activeservice->name, desc); diff --git a/src/netwrite.c b/src/netwrite.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -11,9 +11,10 @@ * /tmp/crossroads-sentto{client,server}.dump. This is of course for deep * mode debugging only. */ -// #define DUMPFILE -int net_write (int sock, unsigned char const *buf, unsigned buflen, +/* #define DUMPFILE */ + +unsigned net_write (int sock, unsigned char const *buf, unsigned buflen, int is_client) { int ret, nfd; struct timeval tv, tv1, tv2, *tvp; @@ -96,7 +97,7 @@ int net_write (int sock, unsigned char const *buf, unsigned buflen, mark_activity (ret, microsec / 1000000, st_intermediate); /* Signal caller how many bytes were written. */ - return (ret); + return ( (unsigned) ret); } diff --git a/src/parser.c b/src/parser.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/parser.h b/src/parser.h @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/restart.c b/src/restart.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/runservice.c b/src/runservice.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/serve.c b/src/serve.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/setprogramtitle.c b/src/setprogramtitle.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -24,11 +24,11 @@ void set_program_title (char const *fmt, ...) { orglen += (strlen(org_argv[i]) + 1); /* Paste in our program name first */ - for (i = 0; i <= strlen(name) && i < orglen; i++) + for (i = 0; i <= (int) strlen(name) && i < orglen; i++) org_argv[0][i] = name[i]; /* Paste in the new title */ - for (j = 0; j < strlen(title) && i + j < orglen; j++) + for (j = 0; j < (int) strlen(title) && i + j < orglen; j++) org_argv[0][i + j] = title[j]; /* Reset remainder of old cmd line */ diff --git a/src/showservices.c b/src/showservices.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/showstatus.c b/src/showstatus.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -29,27 +29,23 @@ static char *timestr (double nsec) { return (buf); } -static char *bytestr (unsigned long long nbytes) { +static char *bytestr (double nbytes) { static char *buf; free (buf); if (nbytes > (double)1024*1024*1024*1024) buf = str_printf ("%.2fTb", - ((double) nbytes) / - ((double) 1024*1024*1024*1024)); + nbytes / ((double) 1024*1024*1024*1024)); else if (nbytes > 1024*1024*1024) buf = str_printf ("%.2fGb", - ((double) nbytes) / - ((double) 1024*1024*1024)); + nbytes / ((double) 1024*1024*1024)); else if (nbytes > 1024*1024) buf = str_printf ("%.2fMb", - ((double) nbytes) / - ((double) 1024*1024)); + nbytes / ((double) 1024*1024)); else if (nbytes > 1024) buf = str_printf ("%.2fKb", - ((double) nbytes) / - (double) 1024); + nbytes / (double) 1024); else buf = str_printf ("%llub", nbytes); diff --git a/src/stagetostring.c b/src/stagetostring.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/statetostring.c b/src/statetostring.c @@ -1,10 +1,16 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ + #include "crossroads.h" char *state_to_string (Backendavail avail) { - return (state_to_string_map[avail]); + int i; + + for (i = 0; statestringmap[i].nm; i++) + if (avail == statestringmap[i].av) + return (statestringmap[i].nm); + return ("UNKNOWN-STATE"); } diff --git a/src/stopdaemon.c b/src/stopdaemon.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/strcasestr.c b/src/strcasestr.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/strexpandformat.c b/src/strexpandformat.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/stringtostate.c b/src/stringtostate.c @@ -1,15 +1,16 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ + #include "crossroads.h" Backendavail string_to_state (char const *str) { int i; - for (i = 0; state_to_string_map[i]; i++) - if (!strcasecmp (str, state_to_string_map[i])) - return (i); + for (i = 0; statestringmap[i].nm; i++) + if (!strcasecmp (str, statestringmap[i].nm)) + return (statestringmap[i].av); return (st_unknown); } diff --git a/src/strlcat.c b/src/strlcat.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/strprintf.c b/src/strprintf.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/strvprintf.c b/src/strvprintf.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/sysrun.c b/src/sysrun.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/tcpserve.c b/src/tcpserve.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/tellservice.c b/src/tellservice.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/thruputlog.c b/src/thruputlog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/trafficlog.c b/src/trafficlog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/uidassume.c b/src/uidassume.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/uidrestore.c b/src/uidrestore.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/unlockreporter.c b/src/unlockreporter.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/usage.c b/src/usage.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/usage.txt b/src/usage.txt @@ -5,18 +5,17 @@ For distributions and updates, visit <http://crossroads.e-tunity.com>. Usage: ** Controlling the daemon: ** - crossroads [flags] start: start all services - crossroads [flags] status: show the active services and their status - crossroads [flags] stop: stop all services - crossroads [flags] restart: stop and then start - crossroads [flags] tell SERVICE BACKEND STATE: mark the named - BACKEND of the SERVICE with the STATE ('available', 'unavailable' - or 'down'). Use the action 'services' to determine SERVICE and - BACKEND names. + crossroads [flags] start: start all services + crossroads [flags] status: show the active services and their status + crossroads [flags] stop: stop all services + crossroads [flags] restart: stop and then start + crossroads [flags] tell SERVICE BACKEND STATE: mark the named + BACKEND of the SERVICE with the STATE ('available/up', 'unavailable' + or 'down'). Use the action 'services' to determine SERVICE and + BACKEND names. ** Configuration related: ** - crossroads [flags] configtest: verify that the config is OK - crossroads [flags] services: show the configured services - crossroads [flags] sampleconf: display a sample configuration + crossroads [flags] configtest: verify that the config is OK + crossroads [flags] services: show the configured services Supported flags: -a: logs starting and finishing activity to syslog diff --git a/src/vsyslog.c b/src/vsyslog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/wakeuphandler.c b/src/wakeuphandler.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/warning.c b/src/warning.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/writelog.c b/src/writelog.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/xmalloc.c b/src/xmalloc.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/xrealloc.c b/src/xrealloc.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ @@ -8,19 +8,19 @@ void *xrealloc (void *block, unsigned sz) { void *newblock; - // msg ("Realloc: block=%x, sz=%u", block, sz); + /* msg ("Realloc: block=%x, sz=%u", block, sz); */ if (! sz) { free (block); newblock = 0; - // msg ("Realloc: freed %x", block); + /* msg ("Realloc: freed %x", block); */ } else if (!block) { if (! (newblock = malloc (sz)) ) error ("Out of memory (while allocating %u bytes)", sz); - // msg ("Realloc: malloc'd %x (%u bytes)", newblock, sz); + /* msg ("Realloc: malloc'd %x (%u bytes)", newblock, sz); */ } else { if (! (newblock = realloc (block, sz)) ) error ("Out of memory (while increasing block to %u bytes)", sz); - // msg ("Realloc'd %x to %x (%u bytes)", block, newblock, sz); + /* msg ("Realloc'd %x to %x (%u bytes)", block, newblock, sz); */ } return (newblock); } diff --git a/src/xstrcat.c b/src/xstrcat.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/xstrcatch.c b/src/xstrcatch.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/src/xstrdup.c b/src/xstrdup.c @@ -1,5 +1,5 @@ /************************************************************************* - * This file is part of Crosroads 1.29, a load balancer and fail over + * This file is part of Crosroads 1.30, a load balancer and fail over * utility for TCP. Copyright (c) Karel Kubat, distributed under GPL. * Visit http://crossroads.e-tunity.com for information. *************************************************************************/ diff --git a/test/breakingclient b/test/breakingclient @@ -0,0 +1,58 @@ +#!/usr/bin/perl + +use strict; +$|++; + +sub sigcatcher { + # warn ("$$: Stopping wgets\n"); + system ("killall -9 wget"); + exit (0); +} + +$SIG{HUP} = \&sigcatcher; + +system ("mkdir -p /tmp/$$") and die ("Cannot mkdir $$"); +chdir ("/tmp/$$") or die ("Cannot chdir to /tmp/$$: $!\n"); +my $run = 0; +while (1) { + print ("$$ Run: ", ++$run); + system ("rm -rf /tmp/$$/localhost* >/dev/null 2>&1"); + my $pid = fork(); + die ("Fork failed: $!\n") unless (defined ($pid)); + if ($pid) { + sleep (3); + system ("killall -9 wget"); + kill ('HUP', $pid); + wait(); + my @fls = glob ("/tmp/$$/localhost:8001/~karel/imagepage/img*png"); + print (" ", $#fls + 1, " images retrieved\n"); + sleep (1); + } else { + open (my $if, + "wget -r -S --http-user=user --http-password=password " . + "--no-cache " . + "http://localhost:8001/~karel/imagepage/index.php 2>&1 |") + or die ("Cannot start wget\n"); + my $via = ''; + while (my $line = <$if>) { + # print ($line); + chomp ($line); + if ($line =~ /Set-Cookie/ and $line =~ /XRID/) { + $line =~ s{.*XRID=}{}; + $line =~ s{;.*}{}; + if ($via eq '') { + $via = $line; + } elsif ($via ne $line) { + warn ("Warning: via changed from $via to $line\n"); + } + } elsif ($line =~ /HTTP\//) { + $line =~ s{.*HTTP/[01. ]*}{}; + $line =~ s{ .*}{}; + warn ("Warning: got status $line\n") + if ($line != 200 and $line != 404); + } + } + close ($if); + exit(0); + } +}