def onClose(self, *args): if not self.tunOpen.done(): RelayMixin.onClose(self, *args, logWarn=False) self.tunOpen.cancel() else: RelayMixin.onClose(self, *args) self.tryRemoveFromPool()
def onClose(self, wasClean, code, reason, logWarn=True): """Logging failed requests.""" logWarn = True if reason and not self.tunOpen.done(): logging.warning(reason + ' (from %s)' % self.peer) logWarn = False RelayMixin.onClose(self, wasClean, code, reason, logWarn=logWarn)
def onClose(self, *args): if not self.tunOpen.done(): RelayMixin.onClose(self, *args, logWarn=False) self.tunOpen.cancel() else: RelayMixin.onClose(self, *args) if self.inPool: self.pool.remove(self)
def onClose(self, *args): if not self.tunOpen.done(): self._writer = None # prevent it from being closed, openTunnel will close it RelayMixin.onClose(self, *args, logWarn=False) self.tunOpen.cancel() else: RelayMixin.onClose(self, *args) self.tryRemoveFromPool()
def onClose(self, wasClean, code, reason, logWarn=True): """Logging failed requests.""" logWarn = True if reason and not self.tunOpen.done(): peer = '{0}:{1}'.format(*self.transport.get_extra_info('peername')) # self.clientInfo is None logging.warning(reason + ' (from %s)' % peer) logWarn = False RelayMixin.onClose(self, wasClean, code, reason, logWarn=logWarn)
def __init__(self): CustomWSClientProtocol.__init__(self) RelayMixin.__init__(self) self.lastIdleTime = None self.checkTimeoutTask = None self.inPool = False self.canReturnErrorPage = False nonce = os.urandom(16) if not config.tun_ssl: self.initCipher(nonce, encryptor=True) self.customWsKey = base64.b64encode(nonce) # nonce used to encrypt in base64
def onClose(self, *args): if not self.tunOpen.done(): # sometimes reason can be None in extremely poor network msg = self.wasNotCleanReason or '' msg = translate_err_msg(msg) logging.error("can't connect to server: %s" % msg) if self.wasNotCleanReason and self.canReturnErrorPage: # write before closing writer self._writer.write(gen_error_page("can't connect to wstan server", msg)) RelayMixin.onClose(self, *args, logWarn=False) self.tunOpen.cancel() else: RelayMixin.onClose(self, *args) self.tryRemoveFromPool()
def __init__(self): WebSocketServerProtocol.__init__(self) RelayMixin.__init__(self) self.clientInfo = None self.connectTargetTask = None
def __init__(self): WebSocketServerProtocol.__init__(self) RelayMixin.__init__(self) self.connectTargetTask = None self._dataToTarget = bytearray()