1 |
|
/* |
2 |
|
* i-scream central monitoring system |
3 |
< |
* http://www.i-scream.org.uk |
3 |
> |
* http://www.i-scream.org |
4 |
|
* Copyright (C) 2000-2002 i-scream |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or |
101 |
|
getInBound("FQDN"); |
102 |
|
_socketOut.println(_socket.getInetAddress().getHostName().toLowerCase()); |
103 |
|
|
104 |
+ |
// try for IP |
105 |
+ |
getInBound("IP"); |
106 |
+ |
_socketOut.println(_socket.getInetAddress().getHostAddress()); |
107 |
+ |
|
108 |
|
// get properties |
109 |
|
String reqProperty = getInBound(); |
110 |
|
while(!reqProperty.equals("ENDCONFIG")) { |
169 |
|
|
170 |
|
// try for {lastModified} |
171 |
|
String lastModified = getInBound(); |
172 |
+ |
long lastmod; |
173 |
+ |
try { |
174 |
+ |
lastmod = Long.parseLong(lastModified); |
175 |
+ |
} |
176 |
+ |
catch(NumberFormatException e) { |
177 |
+ |
_socketOut.println("ERROR"); |
178 |
+ |
throw new IOException("Last Modified invalid: " + e); |
179 |
+ |
} |
180 |
+ |
|
181 |
|
// check to see if a config update has happen |
182 |
< |
boolean newConfig = _configManager.isModified(filelist, Long.parseLong(lastModified)); |
182 |
> |
boolean newConfig = _configManager.isModified(filelist, lastmod); |
183 |
|
if(newConfig) { |
184 |
|
// new config ! |
185 |
< |
_socketOut.println("ERROR"); |
185 |
> |
_socketOut.println("EXPIRED"); |
186 |
|
} |
187 |
|
else { |
188 |
|
// nothing has changed |
236 |
|
String inBound = getInBound(); |
237 |
|
// check if it's what we're expecting |
238 |
|
if(!inBound.equals(expected)) { |
239 |
+ |
_socketOut.println("ERROR"); |
240 |
|
throw new IOException("protocol error - expected:"+expected+" got:" + inBound); |
241 |
|
} |
242 |
|
// it should be ok then |