Skip to content

Commit

Permalink
allow the fake broken connection to specify how long the spinners sho…
Browse files Browse the repository at this point in the history
…w up for (50% of time specified) and ensure we always redraw the spinners from the ui thread

git-svn-id: https://xpra.org/svn/Xpra/trunk@9271 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed May 6, 2015
1 parent f9d0038 commit d982a5b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/xpra/client/ui_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
except:
ALL_CLIPBOARDS = []

FAKE_BROKEN_CONNECTION = os.environ.get("XPRA_FAKE_BROKEN_CONNECTION", "0")=="1"
FAKE_BROKEN_CONNECTION = int(os.environ.get("XPRA_FAKE_BROKEN_CONNECTION", "0"))
PING_TIMEOUT = int(os.environ.get("XPRA_PING_TIMEOUT", "60"))
UNGRAB_KEY = os.environ.get("XPRA_UNGRAB_KEY", "Escape")

Expand Down Expand Up @@ -1146,7 +1146,10 @@ def check_server_echo(self, ping_sent_time):
#no longer connected!
return False
last = self._server_ok
self._server_ok = not FAKE_BROKEN_CONNECTION and self.last_ping_echoed_time>=ping_sent_time
if FAKE_BROKEN_CONNECTION>0:
self._server_ok = (int(time.time()) % FAKE_BROKEN_CONNECTION) <= (FAKE_BROKEN_CONNECTION//2)
else:
self._server_ok = not FAKE_BROKEN_CONNECTION and self.last_ping_echoed_time>=ping_sent_time
log("check_server_echo(%s) last=%s, server_ok=%s", ping_sent_time, last, self._server_ok)
if last!=self._server_ok and not self._server_ok:
log.info("server is not responding, drawing spinners over the windows")
Expand All @@ -1159,7 +1162,7 @@ def timer_redraw():
log.info("server is OK again")
return False
return True
self.redraw_spinners()
self.idle_add(self.redraw_spinners)
self.timeout_add(250, timer_redraw)
return False

Expand Down

0 comments on commit d982a5b

Please sign in to comment.