(self, localaddr, remoteaddr,
data_size_limit=DATA_SIZE_DEFAULT, map=None,
enable_SMTPUTF8=False, decode_data=False)
| 621 | channel_class = SMTPChannel |
| 622 | |
| 623 | def __init__(self, localaddr, remoteaddr, |
| 624 | data_size_limit=DATA_SIZE_DEFAULT, map=None, |
| 625 | enable_SMTPUTF8=False, decode_data=False): |
| 626 | self._localaddr = localaddr |
| 627 | self._remoteaddr = remoteaddr |
| 628 | self.data_size_limit = data_size_limit |
| 629 | self.enable_SMTPUTF8 = enable_SMTPUTF8 |
| 630 | self._decode_data = decode_data |
| 631 | if enable_SMTPUTF8 and decode_data: |
| 632 | raise ValueError("decode_data and enable_SMTPUTF8 cannot" |
| 633 | " be set to True at the same time") |
| 634 | asyncore.dispatcher.__init__(self, map=map) |
| 635 | try: |
| 636 | family = 0 if socket.has_ipv6 else socket.AF_INET |
| 637 | gai_results = socket.getaddrinfo(*localaddr, family=family, |
| 638 | type=socket.SOCK_STREAM) |
| 639 | self.create_socket(gai_results[0][0], gai_results[0][1]) |
| 640 | # try to re-use a server port if possible |
| 641 | self.set_reuse_addr() |
| 642 | self.bind(localaddr) |
| 643 | self.listen(5) |
| 644 | except: |
| 645 | self.close() |
| 646 | raise |
| 647 | else: |
| 648 | print('%s started at %s\n\tLocal addr: %s\n\tRemote addr:%s' % ( |
| 649 | self.__class__.__name__, time.ctime(time.time()), |
| 650 | localaddr, remoteaddr), file=DEBUGSTREAM) |
| 651 | |
| 652 | def handle_accepted(self, conn, addr): |
| 653 | print('Incoming connection from %s' % repr(addr), file=DEBUGSTREAM) |
nothing calls this directly
no test coverage detected