Drop-upload frontend, rerecorded for 1.9 beta (and correcting a minor mistake). Includes some fixes for Windows but not the Windows inotify implementation. fixes #1429

This commit is contained in:
david-sarah
2011-08-08 16:40:49 -07:00
parent 05684b9251
commit 32a7717205
9 changed files with 458 additions and 0 deletions

View File

@ -150,6 +150,7 @@ class Client(node.Node, pollmixin.PollMixin):
# ControlServer and Helper are attached after Tub startup
self.init_ftp_server()
self.init_sftp_server()
self.init_drop_uploader()
hotline_file = os.path.join(self.basedir,
self.SUICIDE_PREVENTION_HOTLINE_FILE)
@ -421,6 +422,22 @@ class Client(node.Node, pollmixin.PollMixin):
sftp_portstr, pubkey_file, privkey_file)
s.setServiceParent(self)
def init_drop_uploader(self):
if self.get_config("drop_upload", "enabled", False, boolean=True):
upload_uri = self.get_config("drop_upload", "upload.uri", None)
local_dir_utf8 = self.get_config("drop_upload", "local.directory", None)
if upload_uri and local_dir_utf8:
try:
from allmydata.frontends import drop_upload
s = drop_upload.DropUploader(self, upload_uri, local_dir_utf8)
s.setServiceParent(self)
s.start()
except Exception, e:
self.log("couldn't start drop-uploader: %r", args=(e,))
else:
self.log("couldn't start drop-uploader: upload.uri or local.directory not specified")
def _check_hotline(self, hotline_file):
if os.path.exists(hotline_file):
mtime = os.stat(hotline_file)[stat.ST_MTIME]