46 |
|
//NEED TO MAJORILY CHANGE THIS BIT ! |
47 |
|
public void run() { |
48 |
|
try { |
49 |
+ |
//variables |
50 |
+ |
String filelist = ""; |
51 |
+ |
String lastModified = ""; |
52 |
+ |
String inBound = ""; |
53 |
|
|
54 |
+ |
inBound = _socketIn.readLine(); |
55 |
+ |
if(!inBound.equals("HEARTBEAT")) { |
56 |
+ |
_socketOut.println("ERROR"); |
57 |
+ |
_socketOut.flush(); |
58 |
+ |
throw new IOException("protocol error - expecting:HEARTBEAT got:" + inBound); |
59 |
+ |
} else { |
60 |
+ |
_socketOut.println("OK"); |
61 |
+ |
_socketOut.flush(); |
62 |
+ |
} |
63 |
+ |
|
64 |
+ |
inBound = _socketIn.readLine(); |
65 |
+ |
if(!inBound.equals("CONFIG")) { |
66 |
+ |
_socketOut.println("ERROR"); |
67 |
+ |
_socketOut.flush(); |
68 |
+ |
throw new IOException("protocol error - expecting:CONFIG got:" + inBound); |
69 |
+ |
} else { |
70 |
+ |
_socketOut.println("OK"); |
71 |
+ |
_socketOut.flush(); |
72 |
+ |
} |
73 |
+ |
|
74 |
+ |
inBound = _socketIn.readLine(); |
75 |
+ |
filelist = inBound; |
76 |
+ |
_socketOut.println("OK"); |
77 |
+ |
_socketOut.flush(); |
78 |
+ |
|
79 |
+ |
inBound = _socketIn.readLine(); |
80 |
+ |
lastModified = inBound; |
81 |
+ |
|
82 |
+ |
boolean newConfig = _configManager.isModified(filelist, Long.parseLong(lastModified)); |
83 |
+ |
|
84 |
+ |
if(newConfig) { |
85 |
+ |
_socketOut.println("ERROR"); |
86 |
+ |
} |
87 |
+ |
else { |
88 |
+ |
_socketOut.println("OK"); |
89 |
+ |
} |
90 |
+ |
_socketOut.flush(); |
91 |
+ |
|
92 |
+ |
inBound = _socketIn.readLine(); |
93 |
+ |
if(!inBound.equals("ENDHEARTBEAT")) { |
94 |
+ |
_socketOut.println("ERROR"); |
95 |
+ |
_socketOut.flush(); |
96 |
+ |
throw new IOException("protocol error - expecting:ENDHEARTBEAT got:" + inBound); |
97 |
+ |
} else { |
98 |
+ |
_socketOut.println("OK"); |
99 |
+ |
_socketOut.flush(); |
100 |
+ |
} |
101 |
|
|
102 |
|
} catch (Exception e) { |
103 |
|
_logRef.write(toString(), Logger.ERROR, "ERROR: " + e.getMessage()); |