chiark
/
gitweb
/
~ian
/
inn-innduct.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
87034f9
)
lowvol fixes
author
Ian Jackson
<ian@chiark.greenend.org.uk>
Wed, 5 May 2010 23:55:03 +0000
(
00:55
+0100)
committer
Ian Jackson
<ian@chiark.greenend.org.uk>
Wed, 5 May 2010 23:55:03 +0000
(
00:55
+0100)
backends/innduct.c
patch
|
blob
|
history
diff --git
a/backends/innduct.c
b/backends/innduct.c
index c42771d885729dae0115eba0ff00f06d04c62e69..6e9dd262dbfd5bd4c573dc5b3c858df6fb949a91 100644
(file)
--- a/
backends/innduct.c
+++ b/
backends/innduct.c
@@
-533,7
+533,7
@@
static char *globpat_backlog;
static pid_t self_pid;
static int *lowvol_perperiod;
static int lowvol_circptr;
static pid_t self_pid;
static int *lowvol_perperiod;
static int lowvol_circptr;
-static int lowvol_total;
+static int lowvol_total;
/* does not include current period */
/* statemc_init initialises */
static StateMachineState sms;
/* statemc_init initialises */
static StateMachineState sms;
@@
-1191,9
+1191,10
@@
static void conn_idle_close(Conn *conn, const char *why) {
static void check_idle_conns(void) {
Conn *conn;
static void check_idle_conns(void) {
Conn *conn;
- int v
erylowvol
= lowvol_perperiod[lowvol_circptr];
+ int v
olthisperiod
= lowvol_perperiod[lowvol_circptr];
lowvol_circptr++;
lowvol_circptr %= lowvol_periods;
lowvol_circptr++;
lowvol_circptr %= lowvol_periods;
+ lowvol_total += volthisperiod;
lowvol_total -= lowvol_perperiod[lowvol_circptr];
lowvol_perperiod[lowvol_circptr]= 0;
lowvol_total -= lowvol_perperiod[lowvol_circptr];
lowvol_perperiod[lowvol_circptr]= 0;
@@
-1222,9
+1223,9
@@
static void check_idle_conns(void) {
}
conn= LIST_HEAD(conns);
}
conn= LIST_HEAD(conns);
- if (!v
erylowvol
&&
+ if (!v
olthisperiod
&&
conns.count==1 &&
conns.count==1 &&
- lowvol_total
+verylowvol
< lowvol_thresh &&
+ lowvol_total < lowvol_thresh &&
!conn_busy(conn))
conn_idle_close(conn, "low volume");
}
!conn_busy(conn))
conn_idle_close(conn, "low volume");
}
@@
-3406,7
+3407,7
@@
CCMD(dump) {
DUMPV("%d", , cli_master);
fprintf(f,"\n");
DUMPV("%d", , cli_master);
fprintf(f,"\n");
- fprintf(f,"lowvol
");
+ fprintf(f,"lowvol");
DUMPV("%d", , lowvol_circptr);
DUMPV("%d", , lowvol_total);
fprintf(f,":");
DUMPV("%d", , lowvol_circptr);
DUMPV("%d", , lowvol_total);
fprintf(f,":");
@@
-3785,6
+3786,7
@@
int main(int argc, char **argv) {
lowvol_perperiod[i]= lowvol_thresh;
lowvol_total += lowvol_thresh;
}
lowvol_perperiod[i]= lowvol_thresh;
lowvol_total += lowvol_thresh;
}
+ lowvol_total -= lowvol_thresh;
/* set things up */
/* set things up */