ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/TCPControlHandler.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/clientinterface/TCPControlHandler.java (file contents):
Revision 1.3 by tdb, Mon Jan 22 23:08:15 2001 UTC vs.
Revision 1.4 by tdb, Tue Jan 23 16:56:31 2001 UTC

# Line 30 | Line 30 | class TCPControlHandler extends Thread {
30       */
31      public final String REVISION = "$Revision$";
32      
33 <    public static final String PROTOVER = "PROTOCOL 1.0";
33 >    public static final String PROTOVER = "PROTOCOL 1.1";
34      
35   //---STATIC METHODS---
36  
37   //---CONSTRUCTORS---
38  
39 <    public TCPControlHandler(Socket socket, Queue queue) throws IOException {
39 >    public TCPControlHandler(Socket socket, PacketSorter ps) throws IOException {
40          _socket = socket;
41 <        _queue = queue;
41 >        _ps = ps;
42          _socketIn = new BufferedReader(new InputStreamReader(_socket.getInputStream()));
43          _socketOut = new PrintWriter(_socket.getOutputStream());
44 +        _hostList = "";
45          _logger.write(toString(), Logger.SYSINIT, "created");
46      }
47      
# Line 102 | Line 103 | class TCPControlHandler extends Thread {
103                          // call accept()
104                          Socket s = ss.accept();
105                          // when we get the Socket back, give it to the data thread
106 <                        TCPDataHandler dh = new TCPDataHandler(s, _queue);
106 >                        TCPDataHandler dh = new TCPDataHandler(s);
107 >                        // register it !
108 >                        _ps.register(dh.getQueue(), _hostList);
109                          // start it up
110                          dh.start();
111                          // HOLD a ref to that data thread
# Line 120 | Line 123 | class TCPControlHandler extends Thread {
123                      if(_dataHandler != null) {
124                          // Shut down the data handler
125                          _dataHandler.shutdown();
126 +                        // Deregister
127 +                        _ps.deregister(_dataHandler.getQueue(), _hostList);
128                          // destroy the reference to it ?
129                          _dataHandler = null;
130                          _socketOut.println("OK");
# Line 131 | Line 136 | class TCPControlHandler extends Thread {
136                          _socketOut.flush();
137                      }
138                  }
139 +                else if(cmd.equals("SETHOSTLIST")) {
140 +                    _socketOut.println("OK");
141 +                    _socketOut.flush();
142 +                    cmd = _socketIn.readLine();
143 +                    _hostList = cmd;
144 +                    _socketOut.println("OK");
145 +                    _socketOut.flush();
146 +                }
147                  else if(cmd.equals("DISCONNECT")) {
148                      run=false;
149                      if(_dataHandler != null) {
# Line 217 | Line 230 | class TCPControlHandler extends Thread {
230       * A hook to the outbound stream for the socket
231       */
232      private PrintWriter _socketOut;
233 <
233 >    
234      /**
235 <     * A reference to the Queue
236 <     */
237 <    private Queue _queue;
235 >         * A reference to the PacketSorter.
236 >         */
237 >    private PacketSorter _ps;
238      
239      private TCPDataHandler _dataHandler;
240      
241      private String _clientName;
242 +    private String _hostList;
243      
244   //---STATIC ATTRIBUTES---
245  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines