Please note that the old 'max timeout' that you could set as an eviron variable
was only 6 seconds.  This is less than the default of 30 seconds, which makes
no sense at all.

The attached patch fixes this:

Give user a better clue as to why xrl router timed out.
Allow user to set up to 2 minute timeout..helps with running
lots of instances under valgrind and other strange things.

Thanks,
Ben

--
Ben Greear <[email protected]>
Candela Technologies Inc  http://www.candelatech.com

diff --git a/libxipc/xrl_router.cc b/libxipc/xrl_router.cc
index 989a4d1..15978a8 100644
--- a/libxipc/xrl_router.cc
+++ b/libxipc/xrl_router.cc
@@ -207,8 +207,9 @@ XrlRouter::initialize(const char* class_name,
        char *ep = NULL;
        timeout_ms = strtoul(value, &ep, 10);
        if ( !(*value != '\0' && *ep == '\0') &&
-             (timeout_ms <= 0 || timeout_ms > 6000)) {
-           XLOG_ERROR("Invalid \"XORP_FINDER_CONNECT_TIMEOUT_MS\": %s", value);
+             (timeout_ms <= 0 || timeout_ms > 120000)) {
+           XLOG_ERROR("Invalid \"XORP_FINDER_CONNECT_TIMEOUT_MS\": %s  (must 
be 0 < timeout < 120000)",
+                      value);
            timeout_ms = DEFAULT_FINDER_CONNECT_TIMEOUT_MS;
        }
     }
@@ -737,26 +738,44 @@ XrlRouter::get_sender(const string& target)
     return *s;
 }
 
-
+string XrlRouter::toString() const {
+    ostringstream oss;
+    if (_fac) {
+       oss << " fac enabled: " << _fac->enabled() << " fac connect failed: "
+           << _fac->connect_failed() << " fac connected: " << _fac->connected()
+           << " ready: " << ready() << endl;
+    }
+    else {
+       oss << " fac NULL, ready: " << ready() << endl;
+    }
+    return oss.str();
+}
+
+
+
 // ----------------------------------------------------------------------------
 // wait_until_xrl_router_is_ready
 
 void
 wait_until_xrl_router_is_ready(EventLoop& eventloop, XrlRouter& xrl_router)
 {
-    while (xrl_router.failed() == false) {
+    if (xlog_is_running()) {
+       XLOG_WARNING("Starting xrl_router_is_ready method....\n");
+    }
+    while (! xrl_router.failed()) {
        eventloop.run();
        if (xrl_router.ready())
            return;
     }
 
-    static const char* msg = "XrlRouter failed.  No Finder?";
+    ostringstream msg;
+    msg << "XrlRouter failed.  No Finder?  xrl_router debug: " << 
xrl_router.toString() << endl;
     if (xlog_is_running()) {
-       XLOG_ERROR("%s", msg);
+       XLOG_ERROR("%s", msg.str().c_str());
        xlog_stop();
        xlog_exit();
     } else {
-       fprintf(stderr, "%s", msg);
+       fprintf(stderr, "%s", msg.str().c_str());
     }
     exit(-1);
 }
diff --git a/libxipc/xrl_router.hh b/libxipc/xrl_router.hh
index bb56a01..29ef12a 100644
--- a/libxipc/xrl_router.hh
+++ b/libxipc/xrl_router.hh
@@ -107,6 +107,8 @@ public:
      */
     bool failed() const;
 
+    string toString() const;
+
     /**
      * Send XRL.
      *
_______________________________________________
Xorp-hackers mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/xorp-hackers

Reply via email to