get rid of 'add_service' (just an alias to setServiceParent anyway)
This commit is contained in:
parent
ea99915af6
commit
08e0c3b7e2
|
@ -433,7 +433,7 @@ class _Client(node.Node, pollmixin.PollMixin):
|
||||||
def init_stats_provider(self):
|
def init_stats_provider(self):
|
||||||
gatherer_furl = self.config.get_config("client", "stats_gatherer.furl", None)
|
gatherer_furl = self.config.get_config("client", "stats_gatherer.furl", None)
|
||||||
self.stats_provider = StatsProvider(self, gatherer_furl)
|
self.stats_provider = StatsProvider(self, gatherer_furl)
|
||||||
self.add_service(self.stats_provider)
|
self.stats_provider.setServiceParent(self)
|
||||||
self.stats_provider.register_producer(self)
|
self.stats_provider.register_producer(self)
|
||||||
|
|
||||||
def get_stats(self):
|
def get_stats(self):
|
||||||
|
@ -545,7 +545,7 @@ class _Client(node.Node, pollmixin.PollMixin):
|
||||||
expiration_override_lease_duration=o_l_d,
|
expiration_override_lease_duration=o_l_d,
|
||||||
expiration_cutoff_date=cutoff_date,
|
expiration_cutoff_date=cutoff_date,
|
||||||
expiration_sharetypes=expiration_sharetypes)
|
expiration_sharetypes=expiration_sharetypes)
|
||||||
self.add_service(ss)
|
ss.setServiceParent(self)
|
||||||
|
|
||||||
furl_file = self.config.get_private_path("storage.furl").encode(get_filesystem_encoding())
|
furl_file = self.config.get_private_path("storage.furl").encode(get_filesystem_encoding())
|
||||||
furl = self.tub.registerReference(ss, furlFile=furl_file)
|
furl = self.tub.registerReference(ss, furlFile=furl_file)
|
||||||
|
@ -571,8 +571,12 @@ class _Client(node.Node, pollmixin.PollMixin):
|
||||||
self.history = History(self.stats_provider)
|
self.history = History(self.stats_provider)
|
||||||
self.terminator = Terminator()
|
self.terminator = Terminator()
|
||||||
self.terminator.setServiceParent(self)
|
self.terminator.setServiceParent(self)
|
||||||
self.add_service(Uploader(helper_furl, self.stats_provider,
|
uploader = Uploader(
|
||||||
self.history))
|
helper_furl,
|
||||||
|
self.stats_provider,
|
||||||
|
self.history,
|
||||||
|
)
|
||||||
|
uploader.setServiceParent(self)
|
||||||
self.init_blacklist()
|
self.init_blacklist()
|
||||||
self.init_nodemaker()
|
self.init_nodemaker()
|
||||||
|
|
||||||
|
@ -670,7 +674,7 @@ class _Client(node.Node, pollmixin.PollMixin):
|
||||||
staticdir_config = self.config.get_config("node", "web.static", "public_html").decode("utf-8")
|
staticdir_config = self.config.get_config("node", "web.static", "public_html").decode("utf-8")
|
||||||
staticdir = self.config.get_config_path(staticdir_config)
|
staticdir = self.config.get_config_path(staticdir_config)
|
||||||
ws = WebishServer(self, webport, nodeurl_path, staticdir)
|
ws = WebishServer(self, webport, nodeurl_path, staticdir)
|
||||||
self.add_service(ws)
|
ws.setServiceParent(self)
|
||||||
|
|
||||||
def init_ftp_server(self):
|
def init_ftp_server(self):
|
||||||
if self.config.get_config("ftpd", "enabled", False, boolean=True):
|
if self.config.get_config("ftpd", "enabled", False, boolean=True):
|
||||||
|
|
|
@ -95,7 +95,7 @@ class _IntroducerNode(node.Node):
|
||||||
raise ValueError("config error: we are Introducer, but tub "
|
raise ValueError("config error: we are Introducer, but tub "
|
||||||
"is not listening ('tub.port=' is empty)")
|
"is not listening ('tub.port=' is empty)")
|
||||||
introducerservice = IntroducerService()
|
introducerservice = IntroducerService()
|
||||||
self.add_service(introducerservice)
|
introducerservice.setServiceParent(self)
|
||||||
|
|
||||||
old_public_fn = self.config.get_config_path(u"introducer.furl")
|
old_public_fn = self.config.get_config_path(u"introducer.furl")
|
||||||
private_fn = self.config.get_private_path(u"introducer.furl")
|
private_fn = self.config.get_private_path(u"introducer.furl")
|
||||||
|
@ -125,7 +125,7 @@ class _IntroducerNode(node.Node):
|
||||||
config_staticdir = self.get_config("node", "web.static", "public_html").decode('utf-8')
|
config_staticdir = self.get_config("node", "web.static", "public_html").decode('utf-8')
|
||||||
staticdir = self.config.get_config_path(config_staticdir)
|
staticdir = self.config.get_config_path(config_staticdir)
|
||||||
ws = IntroducerWebishServer(self, webport, nodeurl_path, staticdir)
|
ws = IntroducerWebishServer(self, webport, nodeurl_path, staticdir)
|
||||||
self.add_service(ws)
|
ws.setServiceParent(self)
|
||||||
|
|
||||||
@implementer(RIIntroducerPublisherAndSubscriberService_v2)
|
@implementer(RIIntroducerPublisherAndSubscriberService_v2)
|
||||||
class IntroducerService(service.MultiService, Referenceable):
|
class IntroducerService(service.MultiService, Referenceable):
|
||||||
|
|
|
@ -788,7 +788,3 @@ class Node(service.MultiService):
|
||||||
|
|
||||||
def log(self, *args, **kwargs):
|
def log(self, *args, **kwargs):
|
||||||
return log.msg(*args, **kwargs)
|
return log.msg(*args, **kwargs)
|
||||||
|
|
||||||
def add_service(self, s):
|
|
||||||
s.setServiceParent(self)
|
|
||||||
return s
|
|
||||||
|
|
|
@ -163,15 +163,11 @@ class SystemFramework(pollmixin.PollMixin):
|
||||||
d.addCallback(lambda res: passthrough)
|
d.addCallback(lambda res: passthrough)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def add_service(self, s):
|
|
||||||
s.setServiceParent(self.sparent)
|
|
||||||
return s
|
|
||||||
|
|
||||||
def make_introducer(self):
|
def make_introducer(self):
|
||||||
iv_basedir = os.path.join(self.testdir, "introducer")
|
iv_basedir = os.path.join(self.testdir, "introducer")
|
||||||
os.mkdir(iv_basedir)
|
os.mkdir(iv_basedir)
|
||||||
iv = introducer.IntroducerNode(basedir=iv_basedir)
|
self.introducer = introducer.IntroducerNode(basedir=iv_basedir)
|
||||||
self.introducer = self.add_service(iv)
|
self.introducer.setServiceParent(self)
|
||||||
self.introducer_furl = self.introducer.introducer_url
|
self.introducer_furl = self.introducer.introducer_url
|
||||||
|
|
||||||
def make_nodes(self):
|
def make_nodes(self):
|
||||||
|
@ -201,7 +197,8 @@ class SystemFramework(pollmixin.PollMixin):
|
||||||
# so our internal nodes can refuse requests
|
# so our internal nodes can refuse requests
|
||||||
f.write("readonly = true\n")
|
f.write("readonly = true\n")
|
||||||
f.close()
|
f.close()
|
||||||
c = self.add_service(client.Client(basedir=nodedir))
|
c = client.Client(basedir=nodedir)
|
||||||
|
c.setServiceParent(self)
|
||||||
self.nodes.append(c)
|
self.nodes.append(c)
|
||||||
# the peers will start running, eventually they will connect to each
|
# the peers will start running, eventually they will connect to each
|
||||||
# other and the introducer
|
# other and the introducer
|
||||||
|
|
|
@ -557,8 +557,8 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
|
||||||
f = open(os.path.join(iv_dir, "private", "node.pem"), "w")
|
f = open(os.path.join(iv_dir, "private", "node.pem"), "w")
|
||||||
f.write(SYSTEM_TEST_CERTS[0])
|
f.write(SYSTEM_TEST_CERTS[0])
|
||||||
f.close()
|
f.close()
|
||||||
iv = yield create_introducer(basedir=iv_dir)
|
self.introducer = yield create_introducer(basedir=iv_dir)
|
||||||
self.introducer = self.add_service(iv)
|
self.introducer.setServiceParent(self)
|
||||||
self._get_introducer_web()
|
self._get_introducer_web()
|
||||||
if use_stats_gatherer:
|
if use_stats_gatherer:
|
||||||
yield self._set_up_stats_gatherer(None)
|
yield self._set_up_stats_gatherer(None)
|
||||||
|
@ -610,7 +610,7 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
|
||||||
fileutil.write(os.path.join(statsdir, "port"), port_endpoint)
|
fileutil.write(os.path.join(statsdir, "port"), port_endpoint)
|
||||||
self.stats_gatherer_svc = StatsGathererService(statsdir)
|
self.stats_gatherer_svc = StatsGathererService(statsdir)
|
||||||
self.stats_gatherer = self.stats_gatherer_svc.stats_gatherer
|
self.stats_gatherer = self.stats_gatherer_svc.stats_gatherer
|
||||||
self.add_service(self.stats_gatherer_svc)
|
self.stats_gatherer_svc.setServiceParent(self)
|
||||||
|
|
||||||
d = fireEventually()
|
d = fireEventually()
|
||||||
sgf = os.path.join(statsdir, 'stats_gatherer.furl')
|
sgf = os.path.join(statsdir, 'stats_gatherer.furl')
|
||||||
|
@ -633,8 +633,8 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
|
||||||
|
|
||||||
# start clients[0], wait for it's tub to be ready (at which point it
|
# start clients[0], wait for it's tub to be ready (at which point it
|
||||||
# will have registered the helper furl).
|
# will have registered the helper furl).
|
||||||
the_client = yield client.create_client(basedirs[0])
|
c = yield client.create_client(basedirs[0])
|
||||||
c = self.add_service(the_client)
|
c.setServiceParent(self)
|
||||||
self.clients.append(c)
|
self.clients.append(c)
|
||||||
c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
|
c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
|
||||||
|
|
||||||
|
@ -651,8 +651,8 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
|
||||||
|
|
||||||
# this starts the rest of the clients
|
# this starts the rest of the clients
|
||||||
for i in range(1, self.numclients):
|
for i in range(1, self.numclients):
|
||||||
the_client = yield client.create_client(basedirs[i])
|
c = yield client.create_client(basedirs[i])
|
||||||
c = self.add_service(the_client)
|
c.setServiceParent(self)
|
||||||
self.clients.append(c)
|
self.clients.append(c)
|
||||||
c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
|
c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
|
||||||
log.msg("STARTING")
|
log.msg("STARTING")
|
||||||
|
@ -751,7 +751,7 @@ class SystemTestMixin(pollmixin.PollMixin, testutil.StallMixin):
|
||||||
new_c = yield client.create_client(self.getdir("client%d" % num))
|
new_c = yield client.create_client(self.getdir("client%d" % num))
|
||||||
self.clients[num] = new_c
|
self.clients[num] = new_c
|
||||||
new_c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
|
new_c.set_default_mutable_keysize(TEST_RSA_KEY_SIZE)
|
||||||
self.add_service(new_c)
|
new_c.setServiceParent(self)
|
||||||
d.addCallback(_stopped)
|
d.addCallback(_stopped)
|
||||||
d.addCallback(lambda res: self.wait_for_connections())
|
d.addCallback(lambda res: self.wait_for_connections())
|
||||||
def _maybe_get_webport(res):
|
def _maybe_get_webport(res):
|
||||||
|
|
Loading…
Reference in New Issue