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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Marc-André Lureau <marcandre.lureau@xxxxxxxxx>

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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]