--- projects/cms/source/server/uk/org/iscream/cms/server/filter/TCPReaderInit.java 2001/02/01 00:18:42 1.14 +++ projects/cms/source/server/uk/org/iscream/cms/server/filter/TCPReaderInit.java 2001/02/07 13:47:11 1.15 @@ -16,7 +16,7 @@ import uk.ac.ukc.iscream.util.*; * This provides Host heartbeat functionality * * @author $Author: tdb $ - * @version $Id: TCPReaderInit.java,v 1.14 2001/02/01 00:18:42 tdb Exp $ + * @version $Id: TCPReaderInit.java,v 1.15 2001/02/07 13:47:11 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.14 $"; + public final String REVISION = "$Revision: 1.15 $"; //---STATIC METHODS--- @@ -43,7 +43,7 @@ class TCPReaderInit extends Thread { _queue = queue; // setup the reader & writer _socketIn = new BufferedReader(new InputStreamReader(_socket.getInputStream())); - _socketOut = new PrintWriter(_socket.getOutputStream()); + _socketOut = new PrintWriter(_socket.getOutputStream(), true); _logger.write(toString(), Logger.SYSINIT, "created"); } @@ -64,27 +64,22 @@ class TCPReaderInit extends Thread { 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; @@ -97,16 +92,13 @@ class TCPReaderInit extends Thread { 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(); } String date = new Long(System.currentTimeMillis()).toString(); @@ -120,7 +112,6 @@ class TCPReaderInit extends Thread { _logger.write(toString(), Logger.ERROR, "ERROR: " + e.getMessage()); } - _socketOut.flush(); // Disconnect streams & socket try { _socketIn.close();