From 76655d9b0a6ce5eac2a6d96b9c1d008e7e89b738 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 4 Sep 2006 19:32:24 +0000 Subject: [PATCH] added logic to reconnect to jabber if the child receiving data realizes the connection is gone git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@776 9efc2488-bf62-4759-914b-345cdb29e865 --- src/libstack/osrf_prefork.c | 13 +++++++++++++ src/libstack/osrf_system.h | 1 + 2 files changed, 14 insertions(+) diff --git a/src/libstack/osrf_prefork.c b/src/libstack/osrf_prefork.c index 8f3afcc..988215c 100644 --- a/src/libstack/osrf_prefork.c +++ b/src/libstack/osrf_prefork.c @@ -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 ); diff --git a/src/libstack/osrf_system.h b/src/libstack/osrf_system.h index 847928c..bc2e456 100644 --- a/src/libstack/osrf_system.h +++ b/src/libstack/osrf_system.h @@ -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 */ -- 2.43.2