mirror of
https://github.com/lilydjwg/fcitx.vim.git
synced 2025-12-27 02:24:57 +08:00
fix reconnect logic
This commit is contained in:
parent
6e53d15569
commit
54febc8b22
2 changed files with 5 additions and 2 deletions
|
|
@ -11,13 +11,15 @@ def may_reconnect(func):
|
|||
for _ in range(2):
|
||||
try:
|
||||
return func(self, *args, **kwargs)
|
||||
except dbus.exceptions.DBusException:
|
||||
except (dbus.exceptions.DBusException, AttributeError):
|
||||
self.connect()
|
||||
return wrapped
|
||||
|
||||
class FcitxComm():
|
||||
def __init__(self):
|
||||
self.connect()
|
||||
# don't connect on start; connect on demand
|
||||
# self.connect()
|
||||
pass
|
||||
|
||||
def connect(self):
|
||||
bus = dbus.SessionBus()
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ class FcitxComm(object):
|
|||
try:
|
||||
return func(*args, **kwargs)
|
||||
except (socket.error, socket.timeout, struct.error) as e:
|
||||
self.sock = None
|
||||
self._error(e)
|
||||
|
||||
def _status(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue