Commit daa63138 authored by Mark Andrews's avatar Mark Andrews
Browse files

move to next server on more error

parent 54c750f2
...@@ -251,6 +251,9 @@ static struct { ...@@ -251,6 +251,9 @@ static struct {
struct workitem *tail; struct workitem *tail;
} work, connecting, reading, ids[0x10000]; } work, connecting, reading, ids[0x10000];
static void
nextserver(struct workitem *item);
static void static void
connecttoserver(struct workitem *item); connecttoserver(struct workitem *item);
...@@ -548,6 +551,8 @@ resend(struct workitem *item) { ...@@ -548,6 +551,8 @@ resend(struct workitem *item) {
item->sends++; item->sends++;
UNLINK(work, item, link); UNLINK(work, item, link);
APPEND(work, item, link); APPEND(work, item, link);
} else if (item->summary->type) {
nextserver(item);
} else { } else {
addtag(item, "failed"); addtag(item, "failed");
freeitem(item); freeitem(item);
...@@ -885,8 +890,7 @@ dolookup(struct workitem *item, int type) { ...@@ -885,8 +890,7 @@ dolookup(struct workitem *item, int type) {
id = (id + 1) & 0xffff; id = (id + 1) & 0xffff;
if (tries == 0xffff) { if (tries == 0xffff) {
addtag(item, "skipped"); nextserver(item);
freeitem(item);
return; return;
} }
...@@ -916,10 +920,8 @@ dolookup(struct workitem *item, int type) { ...@@ -916,10 +920,8 @@ dolookup(struct workitem *item, int type) {
item->sends++; item->sends++;
APPEND(work, item, link); APPEND(work, item, link);
APPEND(ids[item->id], item, idlink); APPEND(ids[item->id], item, idlink);
} else { } else
addtag(item, "skipped"); nextserver(item);
freeitem(item);
}
} }
/* /*
...@@ -1655,6 +1657,28 @@ nextserver(struct workitem *item) { ...@@ -1655,6 +1657,28 @@ nextserver(struct workitem *item) {
struct sockaddr_storage storage; struct sockaddr_storage storage;
int id, tries; int id, tries;
/*
* If we are in TCP mode cleanup.
*/
if (item->tcpfd != 0) {
FD_CLR(item->tcpfd, &rfds);
FD_CLR(item->tcpfd, &wfds);
rhandlers[item->tcpfd] = NULL;
whandlers[item->tcpfd] = NULL;
close(item->tcpfd);
item->tcpfd = 0;
}
/*
* Ensure we are on all the correct lists.
*/
if (LINKED(item, rlink))
UNLINK(reading, item, rlink);
if (LINKED(item, clink))
UNLINK(connecting, item, clink);
if (!LINKED(item, link))
UNLINK(work, item, clink);
again: again:
if (++item->test > nservers) { if (++item->test > nservers) {
addtag(item, "timeout"); addtag(item, "timeout");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment