summaryrefslogtreecommitdiffstats
path: root/pacredir.c
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2013-11-15 09:17:18 +0100
committerGravatar Christian Hesse <mail@eworm.de>2013-11-15 09:17:18 +0100
commit5c4409a9f2dd0a26dc706898887e7dcdbe7f9ab4 (patch)
tree1e3e2d33a534fdd8cabf608c269dbb350c2dd390 /pacredir.c
parent9ce014591ffd9a8170866e0081bf5022b65aba9b (diff)
downloadpacredir-5c4409a9f2dd0a26dc706898887e7dcdbe7f9ab4.tar.gz
pacredir-5c4409a9f2dd0a26dc706898887e7dcdbe7f9ab4.tar.zst
rename services.bad to something more descriptive
Diffstat (limited to 'pacredir.c')
-rw-r--r--pacredir.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/pacredir.c b/pacredir.c
index 8079421..343e107 100644
--- a/pacredir.c
+++ b/pacredir.c
@@ -92,10 +92,10 @@ int add_host(const char * host, const char * type) {
write_log(stdout, "Adding host %s with service %s\n", host, type);
tmphosts->host = strdup(host);
tmphosts->pacserve.online = 0;
- tmphosts->pacserve.bad = 0;
+ tmphosts->pacserve.badtime = 0;
tmphosts->pacserve.badcount = 0;
tmphosts->pacdbserve.online = 0;
- tmphosts->pacdbserve.bad = 0;
+ tmphosts->pacdbserve.badtime = 0;
tmphosts->pacdbserve.badcount = 0;
tmphosts->next = malloc(sizeof(struct hosts));
tmphosts->next->host = NULL;
@@ -247,11 +247,11 @@ static void * get_http_code(void * data) {
write_log(stderr, "Could not connect to server %s on port %d.\n", request->host, request->port);
request->http_code = 0;
request->last_modified = 0;
- request->service->bad = tv.tv_sec;
+ request->service->badtime = tv.tv_sec;
request->service->badcount++;
return NULL;
} else {
- request->service->bad = 0;
+ request->service->badtime = 0;
request->service->badcount = 0;
}
@@ -344,8 +344,8 @@ static int ahc_echo(void * cls, struct MHD_Connection * connection, const char *
gettimeofday(&tv, NULL);
/* skip host if offline or had a bad request within last BADTIME seconds */
- if ((dbfile == 1 && (tmphosts->pacdbserve.online == 0 || tmphosts->pacdbserve.bad + tmphosts->pacdbserve.badcount * BADTIME > tv.tv_sec)) ||
- (dbfile == 0 && (tmphosts->pacserve.online == 0 || tmphosts->pacserve.bad + tmphosts->pacserve.bad * BADTIME > tv.tv_sec))) {
+ if ((dbfile == 1 && (tmphosts->pacdbserve.online == 0 || tmphosts->pacdbserve.badtime + tmphosts->pacdbserve.badcount * BADTIME > tv.tv_sec)) ||
+ (dbfile == 0 && (tmphosts->pacserve.online == 0 || tmphosts->pacserve.badtime + tmphosts->pacserve.badcount * BADTIME > tv.tv_sec))) {
tmphosts = tmphosts->next;
continue;
}
@@ -442,9 +442,9 @@ void sighup_callback(int signal) {
write_log(stdout, "Received SIGHUP, resetting bad status for hosts.\n");
while (tmphosts->host != NULL) {
- tmphosts->pacserve.bad = 0;
+ tmphosts->pacserve.badtime = 0;
tmphosts->pacserve.badcount = 0;
- tmphosts->pacdbserve.bad = 0;
+ tmphosts->pacdbserve.badtime = 0;
tmphosts->pacdbserve.badcount = 0;
tmphosts = tmphosts->next;
}
@@ -469,9 +469,9 @@ int main(int argc, char ** argv) {
hosts = malloc(sizeof(struct hosts));
hosts->host = NULL;
hosts->pacserve.online = 0;
- hosts->pacserve.bad = 0;
+ hosts->pacserve.badtime = 0;
hosts->pacdbserve.online = 0;
- hosts->pacdbserve.bad = 0;
+ hosts->pacdbserve.badtime = 0;
hosts->next = NULL;
ignore_interfaces = malloc(sizeof(struct ignore_interfaces));