本文整理汇总了Python中xpra.dotxpra.DotXpra.get_server_state方法的典型用法代码示例。如果您正苦于以下问题:Python DotXpra.get_server_state方法的具体用法?Python DotXpra.get_server_state怎么用?Python DotXpra.get_server_state使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xpra.dotxpra.DotXpra
的用法示例。
在下文中一共展示了DotXpra.get_server_state方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_control_socket
# 需要导入模块: from xpra.dotxpra import DotXpra [as 别名]
# 或者: from xpra.dotxpra.DotXpra import get_server_state [as 别名]
def create_control_socket(self):
dotxpra = DotXpra(self.socket_dir)
name = "proxy-%s" % os.getpid()
sockpath = dotxpra.norm_make_path(name, dotxpra.sockdir())
state = dotxpra.get_server_state(sockpath)
if state in (DotXpra.LIVE, DotXpra.UNKNOWN):
log.warn("You already have a proxy server running at %s, the control socket will not be created!", sockpath)
return False
try:
sock = create_unix_domain_socket(sockpath, None)
sock.listen(5)
except Exception, e:
log.warn("failed to setup control socket %s: %s", sockpath, e)
return False
示例2: create_control_socket
# 需要导入模块: from xpra.dotxpra import DotXpra [as 别名]
# 或者: from xpra.dotxpra.DotXpra import get_server_state [as 别名]
def create_control_socket(self):
dotxpra = DotXpra(self.socket_dir)
name = "proxy-%s" % os.getpid()
sockpath = dotxpra.norm_make_path(name, dotxpra.sockdir())
state = dotxpra.get_server_state(sockpath)
if state in (DotXpra.LIVE, DotXpra.UNKNOWN):
log.warn("You already have a proxy server running at %s, the control socket will not be created!", sockpath)
return False
try:
sock = create_unix_domain_socket(sockpath, None, 0o600)
sock.listen(5)
except:
log.warn("failed to setup control socket %s", sockpath, exc_info=True)
return False
self.control_socket = sock
self.control_socket_path = sockpath
log.info("proxy instance now also available using unix domain socket: %s", self.control_socket_path)
return True
示例3: create_control_socket
# 需要导入模块: from xpra.dotxpra import DotXpra [as 别名]
# 或者: from xpra.dotxpra.DotXpra import get_server_state [as 别名]
def create_control_socket(self):
assert self.socket_dir
dotxpra = DotXpra(self.socket_dir)
sockpath = dotxpra.socket_path(":proxy-%s" % os.getpid())
state = dotxpra.get_server_state(sockpath)
if state in (DotXpra.LIVE, DotXpra.UNKNOWN):
log.warn("You already have a proxy server running at %s, the control socket will not be created!", sockpath)
return False
try:
sock = create_unix_domain_socket(sockpath, None, 0o600)
sock.listen(5)
except Exception as e:
log("create_unix_domain_socket failed for '%s'", sockpath, exc_info=True)
log.error("Error: failed to setup control socket '%s':", sockpath)
log.error(" %s", e)
return False
self.control_socket = sock
self.control_socket_path = sockpath
log.info("proxy instance now also available using unix domain socket:")
log.info(" %s", self.control_socket_path)
return True