* released 1.1.1
* fixed a bug in total failure handling * fixed a bug in timestamp comparison within same second (tv_cmp_ms)
This commit is contained in:
parent
5cbea6fd41
commit
efae1847c3
1
Makefile
1
Makefile
@ -46,3 +46,4 @@ haproxy: haproxy.o
|
|||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -vf *.[oas] *~ core haproxy test nohup.out gmon.out
|
rm -vf *.[oas] *~ core haproxy test nohup.out gmon.out
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
H A - P r o x y
|
H A - P r o x y
|
||||||
---------------
|
---------------
|
||||||
version 1.1.0
|
version 1.1.1
|
||||||
willy tarreau
|
willy tarreau
|
||||||
2002/03/10
|
2002/03/13
|
||||||
|
|
||||||
==============
|
==============
|
||||||
|Introduction|
|
|Introduction|
|
||||||
|
33
haproxy.c
33
haproxy.c
@ -9,6 +9,10 @@
|
|||||||
*
|
*
|
||||||
* ChangeLog :
|
* 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
|
* 2002/03/10
|
||||||
* - released 1.1.0
|
* - released 1.1.0
|
||||||
* - fixed a few timeout bugs
|
* - fixed a few timeout bugs
|
||||||
@ -78,8 +82,8 @@
|
|||||||
#include <linux/netfilter_ipv4.h>
|
#include <linux/netfilter_ipv4.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define HAPROXY_VERSION "1.1.0"
|
#define HAPROXY_VERSION "1.1.1"
|
||||||
#define HAPROXY_DATE "2002/03/10"
|
#define HAPROXY_DATE "2002/03/13"
|
||||||
|
|
||||||
/* this is for libc5 for example */
|
/* this is for libc5 for example */
|
||||||
#ifndef TCP_NODELAY
|
#ifndef TCP_NODELAY
|
||||||
@ -730,7 +734,15 @@ unsigned long tv_delta(struct timeval *tv1, struct timeval *tv2) {
|
|||||||
* compares <tv1> and <tv2> modulo 1ms: returns 0 if equal, -1 if tv1 < tv2, 1 if tv1 > tv2
|
* compares <tv1> and <tv2> 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) {
|
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)))
|
((tv1->tv_sec == tv2->tv_sec + 1) && (tv1->tv_usec + 1000000 >= tv2->tv_usec + 1000)))
|
||||||
return 1;
|
return 1;
|
||||||
else if ((tv2->tv_sec > tv1->tv_sec + 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))
|
else if (tv_iseternity(tv2))
|
||||||
return -1; /* tv2 later than tv1 */
|
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)))
|
((tv1->tv_sec == tv2->tv_sec + 1) && (tv1->tv_usec + 1000000 >= tv2->tv_usec + 1000)))
|
||||||
return 1;
|
return 1;
|
||||||
else if ((tv2->tv_sec > tv1->tv_sec + 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) {
|
else if (s->proxy->options & PR_O_BALANCE) {
|
||||||
if (s->proxy->options & PR_O_BALANCE_RR) {
|
if (s->proxy->options & PR_O_BALANCE_RR) {
|
||||||
int retry = s->proxy->nbservers;
|
int retry = s->proxy->nbservers;
|
||||||
do {
|
while (retry) {
|
||||||
if (s->proxy->cursrv == NULL)
|
if (s->proxy->cursrv == NULL)
|
||||||
s->proxy->cursrv = s->proxy->srv;
|
s->proxy->cursrv = s->proxy->srv;
|
||||||
if (s->proxy->cursrv->state & SRV_RUNNING)
|
if (s->proxy->cursrv->state & SRV_RUNNING)
|
||||||
break;
|
break;
|
||||||
s->proxy->cursrv = s->proxy->cursrv->next;
|
s->proxy->cursrv = s->proxy->cursrv->next;
|
||||||
} while (retry--);
|
retry--;
|
||||||
|
}
|
||||||
|
|
||||||
if (retry == 0) /* no server left */
|
if (retry == 0) /* no server left */
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user