Commit 8f5c6397 authored by Nick Mathewson's avatar Nick Mathewson 🎨
Browse files

r17152@catbus: nickm | 2007-12-14 16:00:08 -0500

 implement reload-bridges-on-sighup.


svn:r12813
parent 5b7d898d
......@@ -3,10 +3,12 @@
# See LICENSE for licensing informatino
import anydbm
import os
import signal
import sys
from twisted.internet import reactor
import bridgedb.Bridges as Bridges
import bridgedb.Dist as Dist
import bridgedb.Time as Time
......@@ -87,6 +89,10 @@ def load(cfg, splitter):
splitter.insert(bridge)
f.close()
_reloadFn = None
def _handleSIGHUP(*args):
reactor.callLater(0, _reloadFn)
def startup(cfg):
cfg.BRIDGE_FILES = [ os.path.expanduser(fn) for fn in cfg.BRIDGE_FILES ]
for key in ("RUN_IN_DIR", "DB_FILE", "DB_LOG_FILE", "MASTER_KEY_FILE",
......@@ -152,6 +158,13 @@ def startup(cfg):
if cfg.EMAIL_DIST and cfg.EMAIL_SHARE:
Server.addSMTPServer(cfg, emailDistributor, emailSchedule)
def reload():
load(cfg, splitter)
global _reloadFn
_reloadFn = reload
signal.signal(signal.SIGHUP, _handleSIGHUP)
try:
print "Starting reactors."
Server.runServers()
......
......@@ -177,7 +177,7 @@ class MailDelivery:
if user.dest.local != self.ctx.username:
raise twisted.mail.smtp.SMTPBadRcpt(user)
return lambda: MailMessage(self.ctx)
class MailFactory(twisted.mail.smtp.SMTPFactory):
def __init__(self, *a, **kw):
twisted.mail.smtp.SMTPFactory.__init__(self, *a, **kw)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment