Example #1
0
 def handle_write(self):  # pylint: disable=inconsistent-return-statements
     """
     Handle writes for sockets during TLS handshake. Requires special
     treatment as during the handshake, buffers must remain empty
     and normal writes must be ignored.
     """
     try:
         # wait for write buffer flush
         if self.tlsStarted and not self.tlsDone and not self.write_buf:
             # logger.debug(
             #    "%s:%i TLS handshaking (write)", self.destination.host,
             #        self.destination.port)
             self.tls_handshake()
         else:
             # logger.debug(
             #    "%s:%i Not TLS handshaking (write)", self.destination.host,
             #        self.destination.port)
             return AdvancedDispatcher.handle_write(self)
     except AttributeError:
         return AdvancedDispatcher.handle_write(self)
     except ssl.SSLError as err:
         if err.errno == ssl.SSL_ERROR_WANT_WRITE:
             return 0
         elif err.errno in _DISCONNECTED_SSL:
             self.handle_close()
             return 0
         logger.info("SSL Error: %s", str(err))
         self.handle_close()
         return
Example #2
0
 def handle_write(self):
     try:
         # wait for write buffer flush
         if self.tlsStarted and not self.tlsDone and not self.write_buf:
             #logger.debug("%s:%i TLS handshaking (write)", self.destination.host, self.destination.port)
             self.tls_handshake()
         else:
             #logger.debug("%s:%i Not TLS handshaking (write)", self.destination.host, self.destination.port)
             return AdvancedDispatcher.handle_write(self)
     except AttributeError:
         return AdvancedDispatcher.handle_write(self)
     except ssl.SSLError as err:
         if err.errno == ssl.SSL_ERROR_WANT_WRITE:
             return 0
         elif err.errno in _DISCONNECTED_SSL:
             self.handle_close()
             return 0
         logger.info("SSL Error: %s", str(err))
         self.handle_close()
         return
Example #3
0
 def handle_write(self):
     try:
         # wait for write buffer flush
         if self.tlsStarted and not self.tlsDone and not self.write_buf:
             #logger.debug("%s:%i TLS handshaking (write)", self.destination.host, self.destination.port)
             self.tls_handshake()
         else:
             #logger.debug("%s:%i Not TLS handshaking (write)", self.destination.host, self.destination.port)
             return AdvancedDispatcher.handle_write(self)
     except AttributeError:
         return AdvancedDispatcher.handle_write(self)
     except ssl.SSLError as err:
         if err.errno == ssl.SSL_ERROR_WANT_WRITE:
             return 0
         elif err.errno in _DISCONNECTED_SSL:
             self.handle_close()
             return 0
         logger.info("SSL Error: %s", str(err))
         self.handle_close()
         return