[Spice-devel] [PATCH spice-xpi 1/2] controller: try connection every second

Marc-André Lureau marcandre.lureau at gmail.com
Fri Mar 7 06:02:40 PST 2014


From: Marc-André Lureau <marcandre.lureau at gmail.com>

Currently, with 10 tries, it takes up to n(n+1)/2 = 55s before
returning failure.

The default firefox plugin timeout is 45s, passed that time, the plugin
is killed. 10s should be enough in normal usage for the client to setup
the unix socket.

https://bugzilla.redhat.com/show_bug.cgi?id=1073461
---
 SpiceXPI/src/plugin/controller.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/SpiceXPI/src/plugin/controller.cpp b/SpiceXPI/src/plugin/controller.cpp
index ac97ce1..bdfcba8 100644
--- a/SpiceXPI/src/plugin/controller.cpp
+++ b/SpiceXPI/src/plugin/controller.cpp
@@ -88,14 +88,13 @@ void SpiceController::SetProxy(const std::string &proxy)
 int SpiceController::Connect(const int nRetries)
 {
     int rc = -1;
-    int sleep_time = 0;
+    int sleep_time = 1;
 
     // try to connect for specified count
     for (int i = 0; rc != 0 && i < nRetries; ++i)
     {
         rc = Connect();
         g_usleep(sleep_time * G_USEC_PER_SEC);
-        ++sleep_time;
     }
     if (rc != 0) {
         g_warning("error connecting");
-- 
1.8.5.3



More information about the Spice-devel mailing list