summaryrefslogtreecommitdiff
path: root/src/mailman/testing
diff options
context:
space:
mode:
authorBarry Warsaw2009-10-18 20:05:15 -0400
committerBarry Warsaw2009-10-18 20:05:15 -0400
commit34e27b816aa120e81a8e970ac1d8847384bd3edf (patch)
treeed28c04e1b0a15cef0cc528031ef243df21d3210 /src/mailman/testing
parent9f6eaef1d836a4234773c0f64dbb09b901ccf21f (diff)
downloadmailman-34e27b816aa120e81a8e970ac1d8847384bd3edf.tar.gz
mailman-34e27b816aa120e81a8e970ac1d8847384bd3edf.tar.zst
mailman-34e27b816aa120e81a8e970ac1d8847384bd3edf.zip
Show that a max_sessions_per_connection == 0 means there's an unlimited number
of sessions per connection (or at least 10 <wink>).
Diffstat (limited to 'src/mailman/testing')
-rw-r--r--src/mailman/testing/layers.py4
-rw-r--r--src/mailman/testing/mta.py34
2 files changed, 19 insertions, 19 deletions
diff --git a/src/mailman/testing/layers.py b/src/mailman/testing/layers.py
index 034e26f83..70b0ae9b1 100644
--- a/src/mailman/testing/layers.py
+++ b/src/mailman/testing/layers.py
@@ -47,7 +47,7 @@ from mailman.i18n import _
from mailman.interfaces.domain import IDomainManager
from mailman.interfaces.messages import IMessageStore
from mailman.testing.helpers import TestableMaster
-from mailman.testing.mta import SessionCountingController
+from mailman.testing.mta import ConnectionCountingController
from mailman.utilities.datetime import factory
from mailman.utilities.string import expand
@@ -220,7 +220,7 @@ class SMTPLayer(ConfigLayer):
assert cls.smtpd is None, 'Layer already set up'
host = config.mta.smtp_host
port = int(config.mta.smtp_port)
- cls.smtpd = SessionCountingController(host, port)
+ cls.smtpd = ConnectionCountingController(host, port)
cls.smtpd.start()
@classmethod
diff --git a/src/mailman/testing/mta.py b/src/mailman/testing/mta.py
index 28e5ec77c..62070cc5d 100644
--- a/src/mailman/testing/mta.py
+++ b/src/mailman/testing/mta.py
@@ -56,8 +56,8 @@ class FakeMTA:
-class SessionCountingChannel(Channel):
- """Count the number of SMTP sessions opened and closed."""
+class StatisticsChannel(Channel):
+ """A channel that can answers to the fake STAT command."""
def smtp_STAT(self, arg):
"""Cause the server to send statistics to its controller."""
@@ -66,13 +66,13 @@ class SessionCountingChannel(Channel):
-class SessionCountingServer(QueueServer):
- """Count the number of SMTP sessions opened and closed."""
+class ConnectionCountingServer(QueueServer):
+ """Count the number of SMTP connections opened."""
def __init__(self, host, port, queue, oob_queue):
"""See `lazr.smtptest.server.QueueServer`."""
QueueServer.__init__(self, host, port, queue)
- self.session_count = 0
+ self._connection_count = 0
# The out-of-band queue is where the server sends statistics to the
# controller upon request.
self._oob_queue = oob_queue
@@ -80,25 +80,25 @@ class SessionCountingServer(QueueServer):
def handle_accept(self):
"""See `lazr.smtp.server.Server`."""
connection, address = self.accept()
- self.session_count += 1
- log.info('[SessionCountingServer] accepted: %s', address)
- SessionCountingChannel(self, connection, address)
+ self._connection_count += 1
+ log.info('[ConnectionCountingServer] accepted: %s', address)
+ StatisticsChannel(self, connection, address)
def reset(self):
"""See `lazr.smtp.server.Server`."""
QueueServer.reset(self)
- self.session_count = 0
+ self._connection_count = 0
def send_statistics(self):
"""Send the current connection statistics to the controller."""
# Do not count the connection caused by the STAT connect.
- self.session_count -= 1
- self._oob_queue.put(self.session_count)
+ self._connection_count -= 1
+ self._oob_queue.put(self._connection_count)
-class SessionCountingController(QueueController):
- """Count the number of SMTP sessions opened and closed."""
+class ConnectionCountingController(QueueController):
+ """Count the number of SMTP connections opened."""
def __init__(self, host, port):
"""See `lazr.smtptest.controller.QueueController`."""
@@ -107,7 +107,7 @@ class SessionCountingController(QueueController):
def _make_server(self, host, port):
"""See `lazr.smtptest.controller.QueueController`."""
- self.server = SessionCountingServer(
+ self.server = ConnectionCountingServer(
host, port, self.queue, self.oob_queue)
def start(self):
@@ -117,10 +117,10 @@ class SessionCountingController(QueueController):
# method causes a connection to occur.
self.reset()
- def get_session_count(self):
- """Retrieve the number of sessions.
+ def get_connection_count(self):
+ """Retrieve the number of connections.
- :return: The number of sessions that have been opened.
+ :return: The number of connections to the server that have been made.
:rtype: integer
"""
smtpd = self._connect()