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

Comparing projects/cms/source/conient/uk/org/iscream/cms/conient/ConnectionHandler.java (file contents):
Revision 1.13 by ajm, Tue Jan 30 02:12:51 2001 UTC vs.
Revision 1.14 by ajm, Sat Feb 3 19:16:33 2001 UTC

# Line 83 | Line 83 | public class ConnectionHandler extends Thread {
83      public static final int QUIT = 5;
84  
85      /**
86 +     * Thread action GETCONFIGURATION
87 +     * Starts the command to obtain the configuration
88 +     * from the server.
89 +     * It then passes the IO to the Configuration object
90 +     * so it can obtain any specific configuration
91 +     */
92 +    public static final int GETCONFIGURATION = 6;
93 +
94 +    /**
95       * This is the time in seconds that this class
96       * should wait on the DataReader class to fully
97       * shutdown after calling shutdown() before
# Line 209 | Line 218 | public class ConnectionHandler extends Thread {
218                                  
219                                  throw new IOException("client name rejected - " + _configuration.getProperty("clientname"));
220                              }
221 +                            // get the config...we are connected now!
222 +                            _actionQueue.add(new Integer(GETCONFIGURATION));
223                          } catch (IOException e) {
224                              // print the error and tidy up what's left
225                              Conient.addMessage("ERROR{control link}: " + e);
# Line 411 | Line 422 | public class ConnectionHandler extends Thread {
422                                  
423                                  Conient.setControlStatus("Disconnected");
424                              } catch (IOException e) {
425 <                                Conient.addMessage("Control Link Error: " + e);
425 >                                Conient.addMessage("ERROR{control link}: " + e);
426                                  try {
427                                      _inBound.close();
428                                      _outBound.close();
# Line 456 | Line 467 | public class ConnectionHandler extends Thread {
467                          Conient.addMessage("WARNING: open connections detected - queueing stop events");
468                      }
469                      break;
470 <                
470 >                case GETCONFIGURATION:
471 >                    if(_controlLink != null) {
472 >                        try {
473 >                            String response = null;
474 >                            _outBound.println("STARTCONFIG");
475 >                            _outBound.flush();
476 >                            response = _inBound.readLine();
477 >                            if (!response.equals("OK")) {
478 >                                throw new IOException("server refused (" + response + ")");
479 >                            }
480 >                            _configuration.readServerConfiguration(_inBound, _outBound);
481 >                            _outBound.println("ENDCONFIG");
482 >                            _outBound.flush();
483 >                            response = _inBound.readLine();
484 >                            if (!response.equals("OK")) {
485 >                                throw new IOException("server reported error when finishing configuration");
486 >                            }
487 >                        } catch (IOException e) {
488 >                            Conient.addMessage("ERROR{control link}: when getting configuration - " + e);
489 >                        }
490 >                    }
491 >                    break;
492              }
493          }
494      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines