Rev 8155 | Rev 8185 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8155 | Rev 8171 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | if(robot_access && loadavg[0]==0) goto refuse; |
46 | if(robot_access && loadavg[0]==0) goto refuse; |
47 | if(loadavg[0]==0) goto repcheck; |
47 | if(loadavg[0]==0) goto repcheck; |
48 | p1=find_word_start(loadavg); p2=find_word_end(p1);*p2=0; |
48 | p1=find_word_start(loadavg); p2=find_word_end(p1);*p2=0; |
49 | dload=atof(p1); |
49 | dload=atof(p1); |
50 | if(robot_access && |
50 | if(robot_access && |
51 | (! |
51 | (!isfinite(dload) || dload>1000 || dload<0 || dload*200>threshold1)) |
52 | goto refuse; |
52 | goto refuse; |
53 | if(! |
53 | if(!isfinite(dload) || dload<=0 || dload>1000) goto repcheck; /* unreasonable */ |
54 | /* very small 1 min load average */ |
54 | /* very small 1 min load average */ |
55 | if(dload*200<threshold1) goto repcheck; |
55 | if(dload*200<threshold1) goto repcheck; |
56 | if(dload*50>threshold2) goto refuse; |
56 | if(dload*50>threshold2) goto refuse; |
57 | p1=find_word_start(p2+1); /* go to second average: 5 min. */ |
57 | p1=find_word_start(p2+1); /* go to second average: 5 min. */ |
58 | *find_word_end(p1)=0; |
58 | *find_word_end(p1)=0; |
59 | dload=atof(p1); |
59 | dload=atof(p1); |
60 | if(! |
60 | if(!isfinite(dload) || dload<=0 || dload>1000) goto repcheck; /* unreasonable */ |
61 | load=dload*100; |
61 | load=dload*100; |
62 | snprintf(buf,sizeof(buf),"%d",load); |
62 | snprintf(buf,sizeof(buf),"%d",load); |
63 | setvar("wims_server_load",buf); |
63 | setvar("wims_server_load",buf); |
64 | /* cut cpu allowance to 3/4 or half if load is high. |
64 | /* cut cpu allowance to 3/4 or half if load is high. |
65 | * But alarm time is not changed */ |
65 | * But alarm time is not changed */ |