From efae1847c3f4ee41c98a4bd5f51ef355765940b5 Mon Sep 17 00:00:00 2001 From: willy tarreau Date: Sat, 17 Dec 2005 12:51:03 +0100 Subject: [PATCH] * released 1.1.1 * fixed a bug in total failure handling * fixed a bug in timestamp comparison within same second (tv_cmp_ms) --- Makefile | 1 + doc/haproxy.txt | 4 ++-- haproxy.c | 33 +++++++++++++++++++++++++++------ 3 files changed, 30 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index ba598430e5..602b057062 100644 --- a/Makefile +++ b/Makefile @@ -46,3 +46,4 @@ haproxy: haproxy.o clean: rm -vf *.[oas] *~ core haproxy test nohup.out gmon.out + diff --git a/doc/haproxy.txt b/doc/haproxy.txt index 4f5ec1452f..f3c27af51d 100644 --- a/doc/haproxy.txt +++ b/doc/haproxy.txt @@ -1,9 +1,9 @@ H A - P r o x y --------------- - version 1.1.0 + version 1.1.1 willy tarreau - 2002/03/10 + 2002/03/13 ============== |Introduction| diff --git a/haproxy.c b/haproxy.c index f1e183bc90..f0c36cdc9a 100644 --- a/haproxy.c +++ b/haproxy.c @@ -9,6 +9,10 @@ * * ChangeLog : * + * 2002/03/12 + * - released 1.1.1 + * - fixed a bug in total failure handling + * - fixed a bug in timestamp comparison within same second (tv_cmp_ms) * 2002/03/10 * - released 1.1.0 * - fixed a few timeout bugs @@ -78,8 +82,8 @@ #include #endif -#define HAPROXY_VERSION "1.1.0" -#define HAPROXY_DATE "2002/03/10" +#define HAPROXY_VERSION "1.1.1" +#define HAPROXY_DATE "2002/03/13" /* this is for libc5 for example */ #ifndef TCP_NODELAY @@ -730,7 +734,15 @@ unsigned long tv_delta(struct timeval *tv1, struct timeval *tv2) { * compares and modulo 1ms: returns 0 if equal, -1 if tv1 < tv2, 1 if tv1 > tv2 */ static inline int tv_cmp_ms(struct timeval *tv1, struct timeval *tv2) { - if ((tv1->tv_sec > tv2->tv_sec + 1) || + if (tv1->tv_sec == tv2->tv_sec) { + if (tv1->tv_usec >= tv2->tv_usec + 1000) + return 1; + else if (tv2->tv_usec >= tv1->tv_usec + 1000) + return -1; + else + return 0; + } + else if ((tv1->tv_sec > tv2->tv_sec + 1) || ((tv1->tv_sec == tv2->tv_sec + 1) && (tv1->tv_usec + 1000000 >= tv2->tv_usec + 1000))) return 1; else if ((tv2->tv_sec > tv1->tv_sec + 1) || @@ -817,7 +829,15 @@ static inline int tv_cmp2_ms(struct timeval *tv1, struct timeval *tv2) { else if (tv_iseternity(tv2)) return -1; /* tv2 later than tv1 */ - if ((tv1->tv_sec > tv2->tv_sec + 1) || + if (tv1->tv_sec == tv2->tv_sec) { + if (tv1->tv_usec >= tv2->tv_usec + 1000) + return 1; + else if (tv2->tv_usec >= tv1->tv_usec + 1000) + return -1; + else + return 0; + } + else if ((tv1->tv_sec > tv2->tv_sec + 1) || ((tv1->tv_sec == tv2->tv_sec + 1) && (tv1->tv_usec + 1000000 >= tv2->tv_usec + 1000))) return 1; else if ((tv2->tv_sec > tv1->tv_sec + 1) || @@ -1032,13 +1052,14 @@ int connect_server(struct session *s) { else if (s->proxy->options & PR_O_BALANCE) { if (s->proxy->options & PR_O_BALANCE_RR) { int retry = s->proxy->nbservers; - do { + while (retry) { if (s->proxy->cursrv == NULL) s->proxy->cursrv = s->proxy->srv; if (s->proxy->cursrv->state & SRV_RUNNING) break; s->proxy->cursrv = s->proxy->cursrv->next; - } while (retry--); + retry--; + } if (retry == 0) /* no server left */ return -1; -- 2.47.3