Skip to content
Snippets Groups Projects
Commit c133041e authored by Eric S. Raymond's avatar Eric S. Raymond
Browse files

Argh. Remember your orders of magnitude...

parent 04389d80
No related branches found
No related tags found
No related merge requests found
...@@ -19,8 +19,6 @@ Requires Python 2.6 and the irc.client library at version >= 2.0.2: see ...@@ -19,8 +19,6 @@ Requires Python 2.6 and the irc.client library at version >= 2.0.2: see
http://sourceforge.net/projects/python-irclib http://sourceforge.net/projects/python-irclib
""" """
# TO-DO: use the CHANLIMIT field in 005.
# These things might need tuning # These things might need tuning
HOST = "localhost" HOST = "localhost"
...@@ -32,7 +30,7 @@ PING_TTL = (15 * 60) # Time to live, seconds from last PING ...@@ -32,7 +30,7 @@ PING_TTL = (15 * 60) # Time to live, seconds from last PING
DISCONNECT_TTL = (24 * 60 * 60) # Time to live, seconds from last connect DISCONNECT_TTL = (24 * 60 * 60) # Time to live, seconds from last connect
UNSEEN_TTL = 60 # Time to live, seconds since first request UNSEEN_TTL = 60 # Time to live, seconds since first request
CHANNEL_MAX = 18 # Max channels open per socket (freenet limit) CHANNEL_MAX = 18 # Max channels open per socket (freenet limit)
ANTI_FLOOD_DELAY = 0.025 # Anti-flood delay after transmissions, seconds ANTI_FLOOD_DELAY = 0.125 # Anti-flood delay after transmissions, seconds
# No user-serviceable parts below this line # No user-serviceable parts below this line
...@@ -80,6 +78,7 @@ class Connection: ...@@ -80,6 +78,7 @@ class Connection:
self.last_xmit = time.time() self.last_xmit = time.time()
self.last_ping = time.time() self.last_ping = time.time()
self.channels_joined = [] self.channels_joined = []
self.channel_max = CHANNEL_MAX
# The consumer thread # The consumer thread
self.queue = Queue.Queue() self.queue = Queue.Queue()
self.thread = threading.Thread(target=self.dequeue) self.thread = threading.Thread(target=self.dequeue)
...@@ -176,7 +175,7 @@ class Connection: ...@@ -176,7 +175,7 @@ class Connection:
return channel in self.channels_joined return channel in self.channels_joined
def accepting(self): def accepting(self):
"Can this connection accept new channel joins?" "Can this connection accept new channel joins?"
return len(self.channels_joined) < CHANNEL_MAX return len(self.channels_joined) < self.channel_max
class Target(): class Target():
"Represent a transmission target." "Represent a transmission target."
...@@ -257,6 +256,8 @@ class Irker: ...@@ -257,6 +256,8 @@ class Irker:
for lump in event.arguments(): for lump in event.arguments():
if lump.startswith("DEAF="): if lump.startswith("DEAF="):
connection.mode(connection.context.nickname(), "+"+lump[5:]) connection.mode(connection.context.nickname(), "+"+lump[5:])
elif lump.startswith("CHANLIMIT=#:"):
connection.context.channel_max = int(lump[12:])
def drop_server(self, servername, port): def drop_server(self, servername, port):
"Drop a server out of the server map." "Drop a server out of the server map."
del self.servers[(servername, port)] del self.servers[(servername, port)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment