Estou com um problema em conexões com Sockets ssl em python
Quando realizo um teste de stress no daemon SMTP que estou escrevendo o client algumas threads de envio morrem com "Connection reset by peer" , porem do lado do servidor não há nenhuma exception e não realizo nenhum tratamento sobre o socket que possa estar capturando o erro.
O daemon é derivado da classe nativa do python SMTPServer e por consequência usa o asyncore.dispatcher para gerenciar as múltiplas conexões
Erro no client:
Exception in thread Thread-21:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 808, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 761, in run
self.__target(*self.__args, **self.__kwargs)
File "pop_bomb_client.py", line 45, in concurrent_thread
sendmess(k)
File "pop_bomb_client.py", line 31, in sendmess
sempop=smtplib.SMTP_SSL(server,465)
File "/usr/lib/python2.7/smtplib.py", line 781, in __init__
SMTP.__init__(self, host, port, local_hostname, timeout)
File "/usr/lib/python2.7/smtplib.py", line 251, in __init__
(code, msg) = self.connect(host, port)
File "/usr/lib/python2.7/smtplib.py", line 311, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/usr/lib/python2.7/smtplib.py", line 787, in _get_socket
new_socket = ssl.wrap_socket(new_socket, self.keyfile, self.certfile)
File "/usr/lib/python2.7/ssl.py", line 451, in wrap_socket
ciphers=ciphers)
File "/usr/lib/python2.7/ssl.py", line 207, in __init__
self.do_handshake()
File "/usr/lib/python2.7/ssl.py", line 369, in do_handshake
self._sslobj.do_handshake()
error: [Errno 104] Connection reset by peer
SocketSSL no Server:
def create_socket(self, family, stype):
self.family_and_type = family, stype
sock = ssl.wrap_socket(socket.socket(family, stype),'cert.key', 'cert.cert',server_side=True, ssl_version=ssl.PROTOCOL_TLSv1)
sock.setblocking(0)
self.set_socket(sock)