From c309151343ea741b6f55d8b42e11c407a4e71a17 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/ILS/trunk@5929 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- OpenSRF/src/libstack/osrf_prefork.c | 13 +++++++++++++ OpenSRF/src/libstack/osrf_system.h | 1 + 2 files changed, 14 insertions(+) diff --git a/OpenSRF/src/libstack/osrf_prefork.c b/OpenSRF/src/libstack/osrf_prefork.c index 8f3afccda6..988215c0b2 100644 --- a/OpenSRF/src/libstack/osrf_prefork.c +++ b/OpenSRF/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/OpenSRF/src/libstack/osrf_system.h b/OpenSRF/src/libstack/osrf_system.h index 847928cfa5..bc2e456ca2 100644 --- a/OpenSRF/src/libstack/osrf_system.h +++ b/OpenSRF/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