added logic to reconnect to jabber if the child receiving data realizes the connectio...
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 4 Sep 2006 19:32:24 +0000 (19:32 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Mon, 4 Sep 2006 19:32:24 +0000 (19:32 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@776 9efc2488-bf62-4759-914b-345cdb29e865

src/libstack/osrf_prefork.c
src/libstack/osrf_system.h

index 8f3afcc..988215c 100644 (file)
@@ -152,6 +152,19 @@ int prefork_child_init_hook(prefork_child* child) {
 void prefork_child_process_request(prefork_child* child, char* data) {
        if( !child ) return;
 
+       transport_client* client = osrfSystemGetTransportClient();
+
+       if(!client_connected(client)) {
+               osrfSystemIgnoreTransportClient();
+               osrfLogWarning(OSRF_LOG_MARK, "Reconnecting child to opensrf after disconnect...");
+               if(!osrf_system_bootstrap_client(NULL, NULL)) {
+                       osrfLogError( OSRF_LOG_MARK, 
+                               "Unable to bootstrap client in prefork_child_process_request()");
+                       sleep(1);
+                       exit(1);
+               }
+       }
+
        /* construct the message from the xml */
        transport_message* msg = new_message_from_xml( data );
 
index 847928c..bc2e456 100644 (file)
@@ -9,6 +9,7 @@
 #include "osrf_cache.h"
 
 
+
 /** Connects to jabber.  Returns 1 on success, 0 on failure 
        contextnode is the location in the config file where we collect config info
 */