[Opensrf-commits] r1092 - in trunk/src/java/org/opensrf: . net/xmpp

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Sep 26 11:27:25 EDT 2007


Author: erickson
Date: 2007-09-26 11:17:36 -0400 (Wed, 26 Sep 2007)
New Revision: 1092

Modified:
   trunk/src/java/org/opensrf/Sys.java
   trunk/src/java/org/opensrf/net/xmpp/XMPPSession.java
Log:
added some more rigorous checking of session connected-ness and some logging

Modified: trunk/src/java/org/opensrf/Sys.java
===================================================================
--- trunk/src/java/org/opensrf/Sys.java	2007-09-24 02:43:04 UTC (rev 1091)
+++ trunk/src/java/org/opensrf/Sys.java	2007-09-26 15:17:36 UTC (rev 1092)
@@ -20,7 +20,8 @@
             throws ConfigException, SessionException  {
 
         /** see if the current thread already has a connection */
-        if(XMPPSession.getThreadSession() != null)
+        XMPPSession existing = XMPPSession.getThreadSession();
+        if(existing != null && existing.connected())
             return;
 
         /** create the config parser */
@@ -47,8 +48,8 @@
         try {
 
             /** Connect to the Jabber network */
+            Logger.info("attempting to create XMPP session "+username+"@"+host+"/"+res);
             XMPPSession xses = new XMPPSession(host, port);
-            System.out.println("resource = " + res);
             xses.connect(username, passwd, res);
             XMPPSession.setThreadSession(xses);
 

Modified: trunk/src/java/org/opensrf/net/xmpp/XMPPSession.java
===================================================================
--- trunk/src/java/org/opensrf/net/xmpp/XMPPSession.java	2007-09-24 02:43:04 UTC (rev 1091)
+++ trunk/src/java/org/opensrf/net/xmpp/XMPPSession.java	2007-09-26 15:17:36 UTC (rev 1092)
@@ -119,9 +119,10 @@
     /** true if this session is connected to the server */
     public boolean connected() {
         return (
-            reader != null && 
-            reader.getXMPPStreamState() == 
-                XMPPReader.XMPPStreamState.CONNECTED);
+                reader != null && 
+                reader.getXMPPStreamState() == XMPPReader.XMPPStreamState.CONNECTED &&
+                !socket.isClosed()
+            );
     }
 
 



More information about the opensrf-commits mailing list