--- haproxy_orig.c 2004-11-05 16:52:09.189374251 +0100
+++ haproxy.c 2004-11-05 19:08:22.125006470 +0100
@@ -309,6 +310,7 @@
#define SRV_RUNNING 1 /* the server is UP */
#define SRV_BACKUP 2 /* this server is a backup server */
#define SRV_MAPPORTS 4 /* this server uses mapped ports */
+#define SRV_COMA 8 /* this server uses mapped ports */
/* what to do when a header matches a regex */
#define ACT_ALLOW 0 /* allow the request */
@@ -486,6 +488,11 @@
int state; /* the state of this fd */
};
+struct coma_list{
+ char server_name[256];
+ struct coma_list *next;
+}; /* end struct coma_list */
+
/*********************************************************************/
int cfg_maxpconn = 2000; /* # of simultaneous connections per proxy (-N) */
@@ -1447,8 +1454,10 @@
do {
if (srv == NULL)
srv = px->srv;
- if (srv->state & SRV_RUNNING
- && !((srv->state & SRV_BACKUP) && ignore_backup))
+ /* tv_delayfrom(&p->stop_time, &now, p->grace);
+ grace_shut
+ */
+ if (!(srv->state & SRV_COMA) && srv->state & SRV_RUNNING && !((srv->state & SRV_BACKUP) && ignore_backup ))
return srv;
srv = srv->next;
} while (srv != px->cursrv);
@@ -2754,25 +2763,52 @@
/* Cool... it's the right one */
struct server *srv = t->proxy->srv;
- while (srv &&
- ((srv->cklen != p4 - p3) || memcmp(p3, srv->cookie, p4 - p3))) {
+ /*
+ while (srv && ((srv->cklen != p4 - p3) || memcmp(p3, srv->cookie, p4 - p3))) {
srv = srv->next;
- }
+ }
+ */
+
+ while (srv){
+ if((srv->cklen == p4 - p3) && !( memcmp(p3, srv->cookie, p4 - p3))){
+ if (srv->state & SRV_RUNNING || t->proxy->options & PR_O_PERSIST) {
+ /* we found the server and it's usable */
+ t->flags &= ~SN_CK_MASK;
+ t->flags |= SN_CK_VALID | SN_DIRECT;
+ t->srv = srv;
+ //fprintf(stderr,">>> bin im else if im process_cli\n");
+ break;
+ }else {
+ t->flags &= ~SN_CK_MASK;
+ t->flags |= SN_CK_DOWN;
+ //fprintf(stderr,">>> bin im else im process_cli\n");
+ }
+ }
+ //fprintf(stderr,">>> while srv\n");
+ srv = srv->next;
+ }/* end while(srv) */
- if (!srv) {
+ //fprintf(stderr,">>> end while srv\n");
+
+ if (!srv && !(t->flags & SN_CK_DOWN)) {
t->flags &= ~SN_CK_MASK;
t->flags |= SN_CK_INVALID;
}
+
+ /* state SLEEP * /
else if (srv->state & SRV_RUNNING || t->proxy->options & PR_O_PERSIST) {
- /* we found the server and it's usable */
+ /* we found the server and it's usable * /
t->flags &= ~SN_CK_MASK;
t->flags |= SN_CK_VALID | SN_DIRECT;
t->srv = srv;
+ fprintf(stderr,"bin im else if im process_cli\n");
}
else {
t->flags &= ~SN_CK_MASK;
t->flags |= SN_CK_DOWN;
+ fprintf(stderr,"bin im else im process_cli\n");
}
+ */
/* if this cookie was set in insert+indirect mode, then it's better that the
* server never sees it.
@@ -3093,6 +3129,8 @@
int len;
len = sprintf(trash, "%08x:%s.clicls[%04x:%04x]\n", t->uniq_id, t->proxy->id, (unsigned short)t->cli_fd, (unsigned short)t->srv_fd);
write(1, trash, len);
+ len = sprintf(trash, "%08X:%s.Flags:%08X\n", t->uniq_id, t->proxy->id,t->flags);
+ write(1, trash, len);
}
return 0;
}
@@ -4437,15 +4475,19 @@
send_log(p, LOG_NOTICE, "SIGUP received, dumping servers states.\n");
while (s) {
- if (s->state & SRV_RUNNING) {
- Warning("SIGHUP: server %s/%s is UP.\n", p->id, s->id);
- send_log(p, LOG_NOTICE, "SIGUP: server %s/%s is UP.\n", p->id, s->id);
- }
- else {
- Warning("SIGHUP: server %s/%s is DOWN.\n", p->id, s->id);
- send_log(p, LOG_NOTICE, "SIGHUP: server %s/%s is DOWN.\n", p->id, s->id);
- }
- s = s->next;
+ if (s->state & SRV_COMA) {
+ Warning("SIGHUP: server %s/%s is in COMA.\n", p->id, s->id);
+ send_log(p, LOG_NOTICE, "SIGUP: server %s/%s is in COMA.\n", p->id, s->id);
+ }
+ else if (s->state & SRV_RUNNING) {
+ Warning("SIGHUP: server %s/%s is UP.\n", p->id, s->id);
+ send_log(p, LOG_NOTICE, "SIGUP: server %s/%s is UP.\n", p->id, s->id);
+ }
+ else {
+ Warning("SIGHUP: server %s/%s is DOWN.\n", p->id, s->id);
+ send_log(p, LOG_NOTICE, "SIGHUP: server %s/%s is DOWN.\n", p->id, s->id);
+ }
+ s = s->next;
}
if (find_server(p) == NULL) {
@@ -4481,6 +4523,98 @@
}
}
+/*
+ * this function
+ */
+void sig_set_server_coma(int sig) {
+ struct proxy *p = proxy;
+ FILE *coma_f = NULL;
+ char *line = NULL;
+ char thisline[256];
+ int linenum = 0;
+ struct coma_list head, *temp = NULL, *new = NULL;
+
+ memset(thisline,'\0',256);
+
+ Warning("SIGUSR2 received, set coma servers.\n");
+
+ if ((coma_f=fopen("comafile.txt","r")) == NULL){
+ Warning("can't open comafile.txt.\n");
+ return;
+ }
+
+ head.next = NULL;
+ temp = &head;
+ while (fgets(thisline,256, coma_f) != NULL) {
+ linenum++;
+ if (thisline[0] != '\0' && thisline[0] != '#') {
+ if ((new = malloc(sizeof(struct coma_list))) == NULL) {
+ Alert("parsing [comafile.txt:%d] : out of memory.\n", linenum);
+ fclose(coma_f);
+ return;
+ }
+ thisline[strlen(thisline)-1]='\0';
+ Warning("thisline :%s:\n",thisline);
+ temp->next = new;
+ new->next = NULL;
+ strncpy(new->server_name, thisline, 256);
+ temp = new;
+ }
+ } /* end while */
+ fclose(coma_f);
+
+ while (p) {
+ struct server *s = p->srv;
+ while (s) {
+ temp = head.next;
+ while (temp){
+ if (!strcmp(temp->server_name, s->id)) {
+ s->state |= SRV_COMA;
+ Warning("Set %s to coma state\n",s->id);
+ break;
+ }
+ temp = temp->next;
+ }
+ if (!temp) s->state &= ~SRV_COMA;
+ s = s->next;
+ }
+ p = p->next;
+ }
+
+ while (head.next) {
+ temp = head.next;
+ head.next = temp->next;
+ free(temp);
+ }
+ /*
+ while (p) {
+ struct server *s = p->srv;
+
+ send_log(p, LOG_NOTICE, "SIGUP received, dumping servers states.\n");
+ while (s) {
+ if (s->state & SRV_RUNNING) {
+ Warning("SIGHUP: server %s/%s is UP.\n", p->id, s->id);
+ send_log(p, LOG_NOTICE, "SIGUP: server %s/%s is UP.\n", p->id, s->id);
+ }
+ else {
+ Warning("SIGHUP: server %s/%s is DOWN.\n", p->id, s->id);
+ send_log(p, LOG_NOTICE, "SIGHUP: server %s/%s is DOWN.\n", p->id, s->id);
+ }
+ s = s->next;
+ }
+
+ if (find_server(p) == NULL) {
+ Warning("SIGHUP: proxy %s has no server available !\n", p);
+ send_log(p, LOG_NOTICE, "SIGHUP: proxy %s has no server available !\n", p);
+ }
+
+ p = p->next;
+ }
+ */
+
+ signal(sig, sig_set_server_coma);
+}/* end sig_set_server_coma */
+
void chain_regex(struct hdr_exp **head, regex_t *preg, int action, char *replace) {
struct hdr_exp *exp;
@@ -6133,6 +6267,7 @@
signal(SIGQUIT, dump);
signal(SIGUSR1, sig_soft_stop);
+ signal(SIGUSR2, sig_set_server_coma);
signal(SIGHUP, sig_dump_state);
/* on very high loads, a sigpipe sometimes happen just between the
I am well aware of the popular opinion that such subjects are too abstruse to be understood by practical mechanics—an assumption that is founded mainly in the fact that the subject of heat and motion are not generally studied, and have been too recently demonstrated in a scientific way to command confidence and attention; but the subject is really no more difficult to understand in an elementary sense than that of the relation between movement and force illustrated in the "mechanical powers" of school-books, which no apprentice ever did or ever will understand, except by first studying the principles of force and motion, independent of mechanical agents, such as screws, levers, wedges, and so on. A new design should be based upon one of two suppositions—either that existing mechanism is imperfect in its construction, or that it lacks functions which a new design may supply; and if those who spend their time in making plans for novel machinery would stop to consider this from the beginning, it would save no little of the time wasted in what may be called scheming without a purpose. A man, coming silently from some concealment, in a dory, undetected in their busy absorption, held something menacingly businesslike and sending sun glints from its blue steel. Its hollow nose covered both at the range he had. “Well, Sky Patrol—and Ground Crew,” he hailed them. “We are going to see some excitement at last!” "You're right, Si," shouted the Lieutenant and Shorty. "Hip, hip, hooray for the Army o' the Cumberland and old Pap Thomas!" "Glad ain't no name for it," said Levi. "Did you say you'd got the boys in there? Here, you men, bring me two or three of those cracker-boxes." "The very same company," gasped the woman. And the other asked: "And the raid'll be made ter-morrer?" "My—" But before they had time to answer, something burst from between the stalls and ran down the darkling slope, brandishing a knife. It was Mexico Bill, running amok, as he had sometimes run before, but on less crowded occasions. The women sent up an ear-splitting yell, and made a fresh onslaught on the hedge. Someone grabbed the half-breed from behind, but his knife flashed, and the next moment he was free, dashing through the gorse towards his victims. Such a discovery could not long remain a secret;—the tale reached the ears of young De Boteler, and, already prepossessed in his favour, it was but a natural consequence that Calverley should rise from being first an assistant, to be the steward, the page, and, at length, the esquire to the heir to the barony of Sudley. But the progress of his fortunes did but add to the malevolence of the detractor and the tale-bearer; theft, sacrilege, and even murder were hinted at as probable causes for a youth, who evidently did not belong to the vulgar, being thus a friendless outcast. But the most charitable surmise was, that he was the offspring of the unhallowed love of some dame or damsel who had reared him in privacy, and had destined him for the church; and that either upon the death of his protectress, or through some fault, he had been expelled from his home. Calverley had a distant authoritative manner towards his equals and inferiors, which, despite every effort, checked inquisitiveness; and all the information he ever gave was, that he was the son of a respectable artizan of the city of London, whom his father's death had left friendless. Whether this statement was correct or not, could never be discovered. Calverley was never known to allude to aught that happened in the years previous to his becoming an inmate of the castle: what little he had said was merely in reply to direct questions. It would seem, then, that he stood alone in the world, and such a situation is by no means enviable; and although duplicity, selfishness and tyranny, formed the principal traits in his character; and though independently of tyranny and selfishness, his mind instinctively shrunk from any contact, save that of necessity, with those beneath him, yet had he gazed upon the growing beauty of Margaret till a love pure and deep—a love in which was concentrated all the slumbering affections, had risen and expanded in his breast, until it had, as it were, become a part of his being. HoMEA一级日本l00免费看
ENTER NUMBET 0018www.baichibang.com.cn
www.nchope.com.cn
3838168.com.cn
quanxuncai.com.cn
www.fsbb350.com.cn
www.sghyfw.com.cn
juuh.com.cn
mi5g.com.cn
www.fjnfhy.com.cn
www.qhxnsw.com.cn