--- projects/cms/source/server/uk/org/iscream/cms/server/filter/TCPReaderInit.java 2000/11/27 10:23:32 1.2 +++ projects/cms/source/server/uk/org/iscream/cms/server/filter/TCPReaderInit.java 2000/11/27 21:48:44 1.3 @@ -16,7 +16,7 @@ import org.omg.CosNaming.*; * * * @author $Author: tdb $ - * @version $Id: TCPReaderInit.java,v 1.2 2000/11/27 10:23:32 tdb Exp $ + * @version $Id: TCPReaderInit.java,v 1.3 2000/11/27 21:48:44 tdb Exp $ */ class TCPReaderInit extends Thread { @@ -25,7 +25,7 @@ class TCPReaderInit extends Thread { /** * The current CVS revision of this class */ - public final String REVISION = "$Revision: 1.2 $"; + public final String REVISION = "$Revision: 1.3 $"; //---STATIC METHODS--- @@ -46,7 +46,58 @@ class TCPReaderInit extends Thread { //NEED TO MAJORILY CHANGE THIS BIT ! public void run() { try { + //variables + String filelist = ""; + String lastModified = ""; + String inBound = ""; + inBound = _socketIn.readLine(); + if(!inBound.equals("HEARTBEAT")) { + _socketOut.println("ERROR"); + _socketOut.flush(); + throw new IOException("protocol error - expecting:HEARTBEAT got:" + inBound); + } else { + _socketOut.println("OK"); + _socketOut.flush(); + } + + inBound = _socketIn.readLine(); + if(!inBound.equals("CONFIG")) { + _socketOut.println("ERROR"); + _socketOut.flush(); + throw new IOException("protocol error - expecting:CONFIG got:" + inBound); + } else { + _socketOut.println("OK"); + _socketOut.flush(); + } + + inBound = _socketIn.readLine(); + filelist = inBound; + _socketOut.println("OK"); + _socketOut.flush(); + + inBound = _socketIn.readLine(); + lastModified = inBound; + + boolean newConfig = _configManager.isModified(filelist, Long.parseLong(lastModified)); + + if(newConfig) { + _socketOut.println("ERROR"); + } + else { + _socketOut.println("OK"); + } + _socketOut.flush(); + + inBound = _socketIn.readLine(); + if(!inBound.equals("ENDHEARTBEAT")) { + _socketOut.println("ERROR"); + _socketOut.flush(); + throw new IOException("protocol error - expecting:ENDHEARTBEAT got:" + inBound); + } else { + _socketOut.println("OK"); + _socketOut.flush(); + } } catch (Exception e) { _logRef.write(toString(), Logger.ERROR, "ERROR: " + e.getMessage());