[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Make bandwidth cap accessible via config file
Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv18537/lib/mixminion/server
Modified Files:
MMTPServer.py ServerConfig.py
Log Message:
Make bandwidth cap accessible via config file
Index: MMTPServer.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/MMTPServer.py,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- MMTPServer.py 6 Feb 2004 23:14:28 -0000 1.75
+++ MMTPServer.py 7 Feb 2004 06:56:45 -0000 1.76
@@ -154,6 +154,13 @@
if con.tryTimeout(cutoff):
self.remove(con,fd)
+ def setBandwidth(self, n):
+ """DOCDOC - n is bytes per second."""
+ if n is None:
+ self.bandwidthPerTick = None
+ else:
+ self.bandwidthPerTick = int(n * self.TICK_INTERVAL)
+
def tick(self):
"""DOCDOC"""
self.bucket = self.bandwidthPerTick
@@ -483,6 +490,7 @@
self._lock = threading.Lock()
self.maxClientConnections = config['Outgoing/MMTP'].get(
'MaxConnections', 16)
+ self.setBandwidth(config['Server'].get('MaxBandwidth', None))
# Don't always listen; don't always retransmit!
# FFFF Support listening on multiple IPs
Index: ServerConfig.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerConfig.py,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- ServerConfig.py 6 Feb 2004 23:14:28 -0000 1.50
+++ ServerConfig.py 7 Feb 2004 06:56:45 -0000 1.51
@@ -99,6 +99,10 @@
mc = self['Outgoing/MMTP'].get('MaxConnections')
if mc is not None and mc < 1:
raise ConfigError("MaxConnections must be at least 1.")
+ bw = self['Outgoing/MMTP'].get('MaxBandwidth')
+ if bw is not None and bw < 4096:
+ #XXXX007 this is completely arbitrary. :P
+ raise ConfigError("MaxBandwidth must be at least 4KB.")
self.validateRetrySchedule("Outgoing/MMTP")
@@ -159,8 +163,8 @@
("Server", ['LogLevel', 'LogStats', 'StatsInterval',
'PublicKeyOverlap', 'Mode', 'MixAlgorithm',
'MixInterval', 'MixPoolRate', 'MixPoolMinSize',
- 'Timeout',]),
- ("Outgoing/MMTP", ['Retry']),
+ 'Timeout','MaxBandwidth']),
+ ("Outgoing/MMTP", ['Retry','MaxConnections']),
("Delivery/SMTP",
['Enabled', 'Retry', 'SMTPServer', 'ReturnAddress', 'FromTag',
'SubjectLine', 'MaximumSize']),
@@ -345,6 +349,7 @@
'MixPoolRate' : ('ALLOW', "fraction", "60%"),
'MixPoolMinSize' : ('ALLOW', "int", "5"),
'Timeout' : ('ALLOW', "interval", "5 min"),
+ 'MaxBandwidth' : ('ALLOW', "size", None),
},
'DirectoryServers' : { # '__SECTION__' : ('REQUIRE', None, None),
'ServerURL' : ('ALLOW*', None, None),
@@ -366,10 +371,10 @@
},
'Outgoing/MMTP' : { 'Enabled' : ('REQUIRE', "boolean", "no"),
'Retry' : ('ALLOW', "intervalList",
- "every 1 hour for 1 day, 7 hours for 5 days"),
- 'MaxConnections' : ('ALLOW', 'int', '16'),
- 'Allow' : ('ALLOW*', "addressSet_allow", None),
- 'Deny' : ('ALLOW*', "addressSet_deny", None) },
+ "every 1 hour for 1 day, 7 hours for 5 days"),
+ 'MaxConnections' : ('ALLOW', 'int', '16'),
+ 'Allow' : ('ALLOW*', "addressSet_allow", None),
+ 'Deny' : ('ALLOW*', "addressSet_deny", None) },
# FFFF Missing: Queue-Size / Queue config options
# FFFF listen timeout??
}