]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
fix references to notifier
authorDavid Stainton <dstainton415@gmail.com>
Wed, 8 Jul 2015 20:13:49 +0000 (13:13 -0700)
committerDaira Hopwood <daira@jacaranda.org>
Wed, 30 Sep 2015 15:45:23 +0000 (16:45 +0100)
src/allmydata/frontends/magic_folder.py
src/allmydata/test/test_magic_folder.py

index e68580c29f8f9fb06ccb6dd6d3790174f04f9b0d..6eba9cc4a340a7f485166744255a1ca820506be1 100644 (file)
@@ -95,7 +95,9 @@ class MagicFolder(service.MultiService):
         self._ignore_count = 0
         self._download_ignore_count = 0
 
-        self._notifier = inotify.INotify()
+        # XXX correct?
+        self._notifier = self._inotify.INotify()
+
         if hasattr(self._notifier, 'set_pending_delay'):
             self._notifier.set_pending_delay(pending_delay)
 
@@ -104,11 +106,11 @@ class MagicFolder(service.MultiService):
         # be an IN_CLOSE_WRITE after an IN_CREATE (I think).
         # TODO: what about IN_MOVE_SELF, IN_MOVED_FROM, or IN_UNMOUNT?
         #
-        self.mask = ( inotify.IN_CLOSE_WRITE
-                    | inotify.IN_MOVED_TO
-                    | inotify.IN_MOVED_FROM
-                    | inotify.IN_DELETE
-                    | inotify.IN_ONLYDIR
+        self.mask = ( self._inotify.IN_CLOSE_WRITE
+                    | self._inotify.IN_MOVED_TO
+                    | self._inotify.IN_MOVED_FROM
+                    | self._inotify.IN_DELETE
+                    | self._inotify.IN_ONLYDIR
                     | IN_EXCL_UNLINK
                     )
         self._notifier.watch(self._local_path, mask=self.mask, callbacks=[self._notify],
@@ -439,5 +441,5 @@ class MagicFolder(service.MultiService):
 
     def _log(self, msg):
         self._client.log("drop-upload: " + msg)
-        #print "_log %s" % (msg,)
+        print "_log %s" % (msg,)
         #open("events", "ab+").write(msg)
index 82fa236ab76d3e8cbb1479cd8cbbc4fbdc09d7f2..21cacc13564dbd989ad54828e7ddb4b0ebe5e68a 100644 (file)
@@ -221,18 +221,24 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_queued'), 0))
 
         def restart(ignore):
+            print "restart"
             tahoe_config_file = os.path.join(self.get_clientdir(), "tahoe.cfg")
             tahoe_config = fileutil.read(tahoe_config_file)
             d3 = defer.succeed(None)
             def write_config(client_node_dir):
+                print "write_config"
                 fileutil.write(os.path.join(client_node_dir, "tahoe.cfg"), tahoe_config)
             def setup_stats(result):
+                print "setup_stats"
+                self.client = None
                 self.set_up_grid(client_config_hooks={0: write_config})
                 self.client = self.g.clients[0]
                 self.stats_provider = self.client.stats_provider
+                self.magicfolder = self.client.getServiceNamed("magic-folder")
+
             d3.addBoth(self.cleanup)
             d3.addCallback(setup_stats)
-            d3.addCallback(self._create_magicfolder)
+            #d3.addCallback(self._create_magicfolder)
             return d3
         d.addCallback(restart)
         d.addCallback(lambda ign: self.failUnlessReallyEqual(self._get_count('magic_folder.objects_succeeded'), 0))
@@ -280,7 +286,6 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
         previously_uploaded = self._get_count('magic_folder.objects_succeeded')
         previously_disappeared = self._get_count('magic_folder.objects_disappeared')
 
-        d = defer.Deferred()
 
         # Note: this relies on the fact that we only get one IN_CLOSE_WRITE notification per file
         # (otherwise we would get a defer.AlreadyCalledError). Should we be relying on that?