diff options
| author | Barry Warsaw | 2009-10-18 20:05:15 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2009-10-18 20:05:15 -0400 |
| commit | 34e27b816aa120e81a8e970ac1d8847384bd3edf (patch) | |
| tree | ed28c04e1b0a15cef0cc528031ef243df21d3210 /src/mailman/testing/mta.py | |
| parent | 9f6eaef1d836a4234773c0f64dbb09b901ccf21f (diff) | |
| download | mailman-34e27b816aa120e81a8e970ac1d8847384bd3edf.tar.gz mailman-34e27b816aa120e81a8e970ac1d8847384bd3edf.tar.zst mailman-34e27b816aa120e81a8e970ac1d8847384bd3edf.zip | |
Diffstat (limited to 'src/mailman/testing/mta.py')
| -rw-r--r-- | src/mailman/testing/mta.py | 34 |
1 files changed, 17 insertions, 17 deletions
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() |
