add src files decompiled via jad
[rsa2client.git] / src / mcsClient / KeepAlive.java
diff --git a/src/mcsClient/KeepAlive.java b/src/mcsClient/KeepAlive.java
new file mode 100644 (file)
index 0000000..f145f12
--- /dev/null
@@ -0,0 +1,63 @@
+// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
+// Jad home page: http://www.kpdus.com/jad.html
+// Decompiler options: packimports(3) fieldsfirst nonlb space 
+
+package mcsClient;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+
+// Referenced classes of package mcsClient:
+//            McsTcpConnection
+
+public class KeepAlive
+    implements Runnable {
+
+    private McsTcpConnection mcsTcpConnection;
+    private int keepaliveMessage[];
+    private boolean blueScreenDump;
+
+    public KeepAlive(McsTcpConnection mcstcpconnection, boolean flag) {
+        keepaliveMessage = new int[3];
+        mcsTcpConnection = mcstcpconnection;
+        blueScreenDump = flag;
+        keepaliveMessage[0] = keepaliveMessage.length * 4;
+        keepaliveMessage[1] = 12;
+    }
+
+    private void cleanupThread() {
+        mcsTcpConnection = null;
+    }
+
+    private void process() {
+        do {
+            Thread.currentThread();
+            if (Thread.interrupted())
+                return;
+            try {
+                Thread.currentThread();
+                Thread.sleep(10000L);
+            }
+            catch (InterruptedException interruptedexception) {
+                return;
+            }
+            keepaliveMessage[2] = (int)System.currentTimeMillis();
+            try {
+                mcsTcpConnection.sendMessage(keepaliveMessage);
+            }
+            catch (IOException ioexception) {
+                System.err.println(ioexception.toString() + " - KeepAlive exiting");
+                if (!blueScreenDump)
+                    JOptionPane.showMessageDialog(new JFrame(), "Connection to host lost", "Remote Console Connection Error", 0);
+                return;
+            }
+        } while (true);
+    }
+
+    public void run() {
+        process();
+        cleanupThread();
+    }
+}