31 lines
791 B
Python
31 lines
791 B
Python
from abc import ABCMeta
|
|
|
|
from aiosmtpd.controller import BaseController, UnixSocketMixin
|
|
from aiosmtpd.lmtp import LMTP
|
|
|
|
|
|
class BaseAsyncController(BaseController, metaclass=ABCMeta):
|
|
def __init__(
|
|
self,
|
|
handler,
|
|
loop,
|
|
**SMTP_parameters,
|
|
):
|
|
super().__init__(
|
|
handler,
|
|
loop,
|
|
**SMTP_parameters,
|
|
)
|
|
|
|
def serve(self):
|
|
return self._create_server()
|
|
|
|
|
|
class UnixSocketLMTPController(UnixSocketMixin, BaseAsyncController):
|
|
def factory(self):
|
|
return LMTP(self.handler)
|
|
|
|
def _trigger_server(self): # pragma: no-unixsock
|
|
# Prevent confusion on which _trigger_server() to invoke.
|
|
# Or so LGTM.com claimed
|
|
UnixSocketMixin._trigger_server(self)
|