예제 #1
0
 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()
예제 #2
0
파일: client.py 프로젝트: krrr/wstan
 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()
예제 #3
0
    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)
예제 #4
0
 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)
예제 #5
0
 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()
예제 #6
0
파일: server.py 프로젝트: krrr/wstan
    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)
예제 #7
0
    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)
예제 #8
0
파일: client.py 프로젝트: ksharpdabu/wstan
 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
예제 #9
0
파일: client.py 프로젝트: krrr/wstan
 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
예제 #10
0
파일: client.py 프로젝트: ksharpdabu/wstan
 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()
예제 #11
0
파일: server.py 프로젝트: krrr/wstan
 def __init__(self):
     WebSocketServerProtocol.__init__(self)
     RelayMixin.__init__(self)
     self.clientInfo = None
     self.connectTargetTask = None
예제 #12
0
 def __init__(self):
     WebSocketServerProtocol.__init__(self)
     RelayMixin.__init__(self)
     self.clientInfo = None
     self.connectTargetTask = None
예제 #13
0
 def __init__(self):
     WebSocketServerProtocol.__init__(self)
     RelayMixin.__init__(self)
     self.connectTargetTask = None
     self._dataToTarget = bytearray()