[Pkg-owncloud-commits] [owncloud-client] 22/115: overlayNautilus: Better reconnect behaviour if mirall was not running.
Sandro Knauß
hefee-guest at moszumanska.debian.org
Fri Aug 29 22:03:56 UTC 2014
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit fcd211b1903cdf3aab6c559e34209c021c5c6369
Author: Klaas Freitag <freitag at owncloud.com>
Date: Wed Aug 13 12:08:38 2014 +0200
overlayNautilus: Better reconnect behaviour if mirall was not running.
---
shell_integration/nautilus/ownCloud.py | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/shell_integration/nautilus/ownCloud.py b/shell_integration/nautilus/ownCloud.py
index ac1ad54..819cf03 100755
--- a/shell_integration/nautilus/ownCloud.py
+++ b/shell_integration/nautilus/ownCloud.py
@@ -11,16 +11,35 @@ class ownCloudExtension(GObject.GObject, Nautilus.ColumnProvider, Nautilus.InfoP
nautilusVFSFile_table = {}
registered_paths = {}
remainder = ''
+ connected = False
+ watch_id = 0
def __init__(self):
- self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- self.sock.connect(("localhost", 33001))
- self.sock.settimeout(5)
-
- GObject.io_add_watch(self.sock, GObject.IO_IN, self.handle_notify)
+ self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ self.connectToOwnCloud
+ if not self.connected:
+ # try again in 5 seconds - attention, logic inverted!
+ GObject.timeout_add(5000, self.connectToOwnCloud)
+
+ def connectToOwnCloud(self):
+ try:
+ self.sock.connect(("localhost", 33001))
+ self.sock.settimeout(5)
+ self.connected = True
+ self.watch_id = GObject.io_add_watch(self.sock, GObject.IO_IN, self.handle_notify)
+ except:
+ print "Connect could not be established, try again later!"
+ return not self.connected
def sendCommand(self, cmd):
- self.sock.send(cmd)
+ if self.connected:
+ try:
+ self.sock.send(cmd)
+ except:
+ print "Sending failed."
+ GObject.source_remove( self.watch_id )
+ self.connected = False
+ GObject.timeout_add(5000, self.connectToOwnCloud)
def find_item_for_file( self, path ):
if path in self.nautilusVFSFile_table:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list