← Back to team overview

epoptes team mailing list archive

[Merge] lp:~oiteam/epoptes/auto-reconnect into lp:epoptes

 

Laércio de Sousa has proposed merging lp:~oiteam/epoptes/auto-reconnect into lp:epoptes.

Requested reviews:
  Epoptes Developers (epoptes)

For more details, see:
https://code.launchpad.net/~oiteam/epoptes/auto-reconnect/+merge/153115

Add an auto-reconnect feature for standalone clients only, as discussed in https://bugs.launchpad.net/epoptes/+bug/1011482. Try to keep the current behavior for thin/fat clients.
-- 
https://code.launchpad.net/~oiteam/epoptes/auto-reconnect/+merge/153115
Your team Epoptes Developers is requested to review the proposed merge of lp:~oiteam/epoptes/auto-reconnect into lp:epoptes.
=== modified file 'epoptes-client/epoptes-client'
--- epoptes-client/epoptes-client	2012-09-27 13:34:27 +0000
+++ epoptes-client/epoptes-client	2013-03-13 11:58:25 +0000
@@ -228,9 +228,21 @@
 # Connect to the server, or keep retrying until the server gets online
 # (for standalone workstations booted before the server).
 if [ -s /etc/epoptes/server.crt ] || [ "$cert_param" = "verify=0" ]; then
-    exec socat openssl-connect:$SERVER:$PORT,$cert_param,interval=60,forever EXEC:"$cmdline"
+    if [ "$TYPE" = "standalone" ]; then
+        while socat openssl-connect:$SERVER:$PORT,$cert_param,interval=60,forever EXEC:"$cmdline"; do
+            log_begin_msg "Connection lost. Epoptes-client reconnecting to $SERVER:$PORT..."
+        done
+    else
+        exec socat openssl-connect:$SERVER:$PORT,$cert_param,interval=60,forever EXEC:"$cmdline"
+    fi
 elif [ -f /etc/epoptes/server.crt ]; then
-   exec socat tcp:$SERVER:$PORT,interval=60,forever EXEC:"$cmdline",nofork
+    if [ "$TYPE" = "standalone" ]; then
+        while socat tcp:$SERVER:$PORT,interval=60,forever EXEC:"$cmdline",nofork; do
+            log_begin_msg "Connection lost. Epoptes-client reconnecting to $SERVER:$PORT..."
+        done
+    else
+        exec socat tcp:$SERVER:$PORT,interval=60,forever EXEC:"$cmdline",nofork
+    fi
 else
     die "
 The epoptes certificate file, /etc/epoptes/server.crt, doesn't exist.