add src files decompiled via jad
[rsa2client.git] / src / mcsClient / KeepAlive.java
1 // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
2 // Jad home page: http://www.kpdus.com/jad.html
3 // Decompiler options: packimports(3) fieldsfirst nonlb space 
4
5 package mcsClient;
6
7 import java.io.IOException;
8 import java.io.PrintStream;
9 import javax.swing.JFrame;
10 import javax.swing.JOptionPane;
11
12 // Referenced classes of package mcsClient:
13 //            McsTcpConnection
14
15 public class KeepAlive
16     implements Runnable {
17
18     private McsTcpConnection mcsTcpConnection;
19     private int keepaliveMessage[];
20     private boolean blueScreenDump;
21
22     public KeepAlive(McsTcpConnection mcstcpconnection, boolean flag) {
23         keepaliveMessage = new int[3];
24         mcsTcpConnection = mcstcpconnection;
25         blueScreenDump = flag;
26         keepaliveMessage[0] = keepaliveMessage.length * 4;
27         keepaliveMessage[1] = 12;
28     }
29
30     private void cleanupThread() {
31         mcsTcpConnection = null;
32     }
33
34     private void process() {
35         do {
36             Thread.currentThread();
37             if (Thread.interrupted())
38                 return;
39             try {
40                 Thread.currentThread();
41                 Thread.sleep(10000L);
42             }
43             catch (InterruptedException interruptedexception) {
44                 return;
45             }
46             keepaliveMessage[2] = (int)System.currentTimeMillis();
47             try {
48                 mcsTcpConnection.sendMessage(keepaliveMessage);
49             }
50             catch (IOException ioexception) {
51                 System.err.println(ioexception.toString() + " - KeepAlive exiting");
52                 if (!blueScreenDump)
53                     JOptionPane.showMessageDialog(new JFrame(), "Connection to host lost", "Remote Console Connection Error", 0);
54                 return;
55             }
56         } while (true);
57     }
58
59     public void run() {
60         process();
61         cleanupThread();
62     }
63 }