Merge branch 'master' into new-proto

This commit is contained in:
Brian Warner 2016-05-24 13:08:21 -07:00
commit c5b174dd6a
3 changed files with 11 additions and 2 deletions

View File

@ -24,6 +24,8 @@ sp_start.add_argument("--transit", default="tcp:3001", metavar="tcp:PORT",
help="endpoint specification for the transit-relay port")
sp_start.add_argument("--advertise-version", metavar="VERSION",
help="version to recommend to clients")
sp_start.add_argument("--signal-error", metavar="ERROR",
help="force all clients to fail with a message")
sp_start.add_argument("--blur-usage", default=None, type=int,
metavar="SECONDS",
help="round logged access times to improve privacy")
@ -47,6 +49,8 @@ sp_restart.add_argument("--transit", default="tcp:3001", metavar="tcp:PORT",
help="endpoint specification for the transit-relay port")
sp_restart.add_argument("--advertise-version", metavar="VERSION",
help="version to recommend to clients")
sp_restart.add_argument("--signal-error", metavar="ERROR",
help="force all clients to fail with a message")
sp_restart.add_argument("--blur-usage", default=None, type=int,
metavar="SECONDS",
help="round logged access times to improve privacy")

View File

@ -13,7 +13,9 @@ class MyPlugin:
from .server import RelayServer
return RelayServer(self.args.rendezvous, self.args.transit,
self.args.advertise_version,
"relay.sqlite", self.args.blur_usage)
"relay.sqlite", self.args.blur_usage,
signal_error=self.args.signal_error,
)
class MyTwistdConfig(twistd.ServerOptions):
subCommands = [("XYZ", None, usage.Options, "node")]

View File

@ -25,7 +25,8 @@ class PrivacyEnhancedSite(server.Site):
class RelayServer(service.MultiService):
def __init__(self, rendezvous_web_port, transit_port,
advertise_version, db_url=":memory:", blur_usage=None):
advertise_version, db_url=":memory:", blur_usage=None,
signal_error=None):
service.MultiService.__init__(self)
self._blur_usage = blur_usage
@ -41,6 +42,8 @@ class RelayServer(service.MultiService):
}
if advertise_version:
welcome["current_version"] = advertise_version
if signal_error:
welcome["error"] = signal_error
rendezvous = Rendezvous(db, welcome, blur_usage)
rendezvous.setServiceParent(self) # for the pruning timer