def __init__(self, bus, gconf):
"""Bus is the cherrypy engine and gconf is a dictionary
containing the CherryPy configuration.
"""
SimplePlugin.__init__(self, bus)
if "pybonjour" not in globals():
self.start = lambda: None
self.exit = lambda: None
return
self.name = "pkg(7) mirror on {0}".format(socket.gethostname())
self.wanted_name = self.name
self.regtype = "_pkg5._tcp"
self.port = gconf["server.socket_port"]
self.sd_hdl = None
self.reg_ok = False
if gconf["server.ssl_certificate"] and \
gconf["server.ssl_private_key"]:
proto = "https"
else:
proto = "http"
netloc = "{0}:{1}".format(socket.getfqdn(), self.port)
self.url = urlunsplit((proto, netloc, '', '', ''))
评论列表
文章目录