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

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


iang        01/04/11 15:33:21

  Modified:    webfunds/sox/server SmartServer.java
  Log:
  diags only

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

Index: SmartServer.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/sox/server/SmartServer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SmartServer.java	2001/04/08 19:41:58	1.2
+++ SmartServer.java	2001/04/11 19:33:20	1.3
@@ -1,6 +1,4 @@
 /*
- * $Id: SmartServer.java,v 1.2 2001/04/08 19:41:58 iang Exp $
- *
  * Copyright (c) 1995-2001 Systemics Inc on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
  */
@@ -32,6 +30,7 @@
  *  switch whenever a problem is detected.
  *
  *  This was webfunds.sox.SmartIssuer.
+ *  @version $Id: SmartServer.java,v 1.3 2001/04/11 19:33:20 iang Exp $
  */
 public class SmartServer
     extends Debug  implements Server                // , IssuerFinder
@@ -195,6 +194,9 @@
         }
     }
 
+    /**
+     *  @return with current alive and well, else throws Exception
+     */
     private void getready()
         throws SOXLaterException, SOXServerException
     {
@@ -204,15 +206,15 @@
         {
             if (!current.isDead())
             {
-                logmsg(" ... smart 'n ready!");
+                logmsg("getReady() ... smart 'n ready!");
                 return ;
             }
 
             current = null;
-            logmsg("old is dead, need new SimpleServer");
+            logmsg("getReady() ... old is dead.");
         }
         else
-            logmsg("first time, need new SimpleServer");
+            logmsg("getReady() ... first time!");
 
         URL url;
         HttpAgent http;
@@ -221,6 +223,8 @@
         int laters   = 0;
 
         int guard = which + servers.length;     // record where we stop
+        logmsg("new SimpleServer, start at " + (which+1) +
+                ", finish after " + guard);
 
         while (which++ < guard)
         {
@@ -240,7 +244,7 @@
                 continue ;
             }
 
-            logmsg(which + " is good");
+            logmsg(which + " is ok SS");
             if (!simp.isDead())               // found a good one
             {
                 current = simp;
@@ -248,6 +252,7 @@
                 logmsg("times " + timediff + " / " + deviation);
                 return ;                      // <<=== normal return here
             }
+            logmsg(which + " is failed? " + simp);
             failures++;  // does this ever happen?
         }
 
@@ -283,7 +288,7 @@
         int laters   = 0;
         while (which < guard)
         {
-            if (current.isDead())
+            if (current == null || current.isDead())
                 getReadyToRequest();
 
             byte[] b;
@@ -394,7 +399,7 @@
                 continue ;
             }
 
-            logmsg(i + " is good: " + page.length);
+            logmsg(i + " is good net: " + page.length);
             logmsg("-----------\n" + new String(page) + "\n----------");
             good++;
         }
@@ -428,6 +433,9 @@
 
     protected void checkTimes()
     {
+        if (current == null)
+            return;
+
         if (!current.isDead())
         {
             try {