0db1b3807a4b1fcb6b9283bcaa32b52adc8ef41e galt Wed Jun 27 17:05:14 2012 -0700 improving botDelay to give us control to allow our own robots to run unbottlenecked if desired via hg.conf setting bottleneck.except diff --git src/hg/lib/botDelay.c src/hg/lib/botDelay.c index 25b499f..b09a27d 100644 --- src/hg/lib/botDelay.c +++ src/hg/lib/botDelay.c @@ -95,34 +95,65 @@ freeMem(botCheckString); if (millis > 0) { if (millis > 10000) { if (millis > 20000) botTerminateMessage(ip, millis); else botDelayMessage(ip, millis); } sleep1000(millis); } } } +boolean botException() +/* check if the remote ip address is on the exceptions list */ +{ +char *exceptIps = cfgOption("bottleneck.except"); +if (exceptIps) + { + char *remoteAddr = getenv("REMOTE_ADDR"); + if (remoteAddr) + { + char *s = exceptIps; + boolean found = FALSE; + while (s && !found) + { + char *e = strchr(s, ' '); + if (e) + *e = 0; + if (sameString(remoteAddr, s)) + found = TRUE; + if (e) + *e++ = ' '; + s = e; + } + if (found) + return TRUE; + } + } +return FALSE; +} void hgBotDelay() /* High level bot delay call - looks up bottleneck server * in hg.conf. */ { +if (botException()) + return; + char *host = cfgOption("bottleneck.host"); char *port = cfgOption("bottleneck.port"); if (host != NULL && port != NULL) botDelayCgi(host, atoi(port)); } int hgBotDelayTime() /* Get suggested delay time from cgi. */ { char *ip = getenv("REMOTE_ADDR"); char *host = cfgOption("bottleneck.host"); char *port = cfgOption("bottleneck.port"); int delay = 0;