本文整理汇总了Python中xpra.net.protocol.Protocol.get_info方法的典型用法代码示例。如果您正苦于以下问题:Python Protocol.get_info方法的具体用法?Python Protocol.get_info怎么用?Python Protocol.get_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xpra.net.protocol.Protocol
的用法示例。
在下文中一共展示了Protocol.get_info方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: XpraClientBase
# 需要导入模块: from xpra.net.protocol import Protocol [as 别名]
# 或者: from xpra.net.protocol.Protocol import get_info [as 别名]
#.........这里部分代码省略.........
raise Exception("override me!")
def warn_and_quit(self, exit_code, message):
log.warn(message)
self.quit(exit_code)
def _process_disconnect(self, packet):
# ie: ("disconnect", "version error", "incompatible version")
reason = bytestostr(packet[1])
info = packet[2:]
s = nonl(reason)
if len(info):
s += " (%s)" % (", ".join([nonl(bytestostr(x)) for x in info]))
if self.server_capabilities is None or len(self.server_capabilities) == 0:
# server never sent hello to us - so disconnect is an error
# (but we don't know which one - the info message may help)
log.warn("server failure: disconnected before the session could be established")
e = EXIT_FAILURE
elif disconnect_is_an_error(reason):
log.warn("server failure: %s", reason)
e = EXIT_FAILURE
else:
if self.exit_code is None:
# we're not in the process of exiting already,
# tell the user why the server is disconnecting us
log.info("server requested disconnect: %s", s)
self.quit(EXIT_OK)
return
self.warn_and_quit(e, "server requested disconnect: %s" % s)
def _process_connection_lost(self, packet):
p = self._protocol
if p and p.input_raw_packetcount == 0:
props = p.get_info()
c = props.get("compression", "unknown")
e = props.get("encoder", "unknown")
netlog.error("Error: failed to receive anything, not an xpra server?")
netlog.error(" could also be the wrong protocol, username, password or port")
if c != "unknown" or e != "unknown":
netlog.error(" or maybe this server does not support '%s' compression or '%s' packet encoding?", c, e)
if self.exit_code != 0:
self.warn_and_quit(EXIT_CONNECTION_LOST, "Connection lost")
def _process_challenge(self, packet):
authlog("processing challenge: %s", packet[1:])
def warn_server_and_exit(code, message, server_message="authentication failed"):
authlog.error("Error: authentication failed:")
authlog.error(" %s", message)
self.disconnect_and_quit(code, server_message)
if not self.has_password():
warn_server_and_exit(
EXIT_PASSWORD_REQUIRED,
"this server requires authentication, please provide a password",
"no password available",
)
return
password = self.load_password()
if not password:
warn_server_and_exit(
EXIT_PASSWORD_FILE_ERROR,
"failed to load password from file %s" % self.password_file,
"no password available",
)
return