[Webfunds-commits] java/webfunds/sox/server SimpleServer.java

Ian Grigg iang@cypherpunks.ai
Wed, 11 Apr 2001 15:33:05 -0400 (AST)


iang        01/04/11 15:33:05

  Modified:    webfunds/sox/server SimpleServer.java
  Log:
  diags, fixed isDead to be Dead not Alive!

Revision  Changes    Path
1.3       +16 -16    java/webfunds/sox/server/SimpleServer.java

Index: SimpleServer.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/server/SimpleServer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SimpleServer.java	2001/04/08 19:41:58	1.2
+++ SimpleServer.java	2001/04/11 19:33:04	1.3
@@ -1,5 +1,4 @@
 /*
- * $Id: SimpleServer.java,v 1.2 2001/04/08 19:41:58 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -39,13 +38,14 @@
  * This class is a "Server Agent" that passes basic requests to the Server.
  * It should be passive until requested.
  *
- * @version 1.3
+ * @version $Id: SimpleServer.java,v 1.3 2001/04/11 19:33:04 iang Exp $
  */
 public final class SimpleServer
     extends Debug
     implements Server
 {
-    protected String logfix = "         i-";
+    protected final static String TAB = "         ";
+    protected String logfix = TAB + "i-";
 
     /**
      * The name of the server.
@@ -268,7 +268,7 @@
         Certificate cert = null;
         try {
             cert = basicAgent.getServerKey();
-            logmsg("Got a cert!" + serverCert);
+            logmsg("Got a cert! " + cert);
         } catch (SOXLaterException ex) {
             setDead(ex.getMessage());      // URL is wrong or server is down
             throw ex ;
@@ -429,12 +429,12 @@
     // if a fatal exception is found, set me as Dead, force user to re-invoke
     protected int          bullets      = 0;
     protected String       reason       = "";
-    public boolean         isDead()             { return bullets == 0 ; }
-    public void            setDead()            { bullets++; }
-    public void            setDead(String s)    { bullets++; reason = s; }
-    public void            setAlive()           { bullets = 0; }
-    public String          getDead()            { return reason; }
-    public boolean         tooDead()            { return (bullets % 10) == 9; }
+    public boolean         isDead()           { return bullets != 0 ; }
+    public void            setDead()          { bullets++; }
+    public void            setDead(String s)  { bullets++; reason = s; }
+    public void            setAlive()         { bullets = 0; }
+    public String          getDead()          { return "("+bullets+")"+reason; }
+    public boolean         tooDead()          { return (bullets % 10) == 9; }
 
 
 
@@ -545,13 +545,13 @@
 
     public String toString()
     {
-        String retval = "SimpleServer " + name + ": " + basicAgent;
+        String s = "SimpleServer " + name + ": ";
 
-        //retval += "\tName: "+name +"\n";
-        //retval += "\tBasic Agent: "+basicAgent+"\n";
-        //retval += "\tPrimary certificate: "+serverCert+"\n";
-        //retval += "\tComms certificate: "+commsKey+"\n";
+        if (isDead())
+            s += "\n" + TAB + getDead();
+
+        s += basicAgent;
 
-        return retval;
+        return s;
     }
 }