diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2008-03-17 09:06:25 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2008-03-17 09:06:25 +0000 |
commit | 694080a0533dcf98b90f31ab1b8bef1a30ffd692 (patch) | |
tree | 24e1a1baaf7d047d9e276c8536ce502a4bd9fe96 /TAO/tests | |
parent | 3d776301555c1b2576190a986689686724de0b0e (diff) | |
download | ATCD-694080a0533dcf98b90f31ab1b8bef1a30ffd692.tar.gz |
Mon Mar 17 09:02:57 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/tests')
-rw-r--r-- | TAO/tests/Bug_3251_Regression/Bug_3251.conf | 3 | ||||
-rw-r--r-- | TAO/tests/Bug_3251_Regression/Bug_3251.conf.xml | 30 | ||||
-rw-r--r-- | TAO/tests/Bug_3251_Regression/Bug_3251_Regression.mpc | 18 | ||||
-rw-r--r-- | TAO/tests/Bug_3251_Regression/DllOrb.cpp | 176 | ||||
-rw-r--r-- | TAO/tests/Bug_3251_Regression/DllOrb.h | 38 | ||||
-rw-r--r-- | TAO/tests/Bug_3251_Regression/PersistentPoa.cpp | 104 | ||||
-rw-r--r-- | TAO/tests/Bug_3251_Regression/PersistentPoa.h | 46 | ||||
-rw-r--r-- | TAO/tests/Bug_3251_Regression/bug_3251_export.h | 58 | ||||
-rw-r--r-- | TAO/tests/Bug_3251_Regression/run_test.pl | 31 | ||||
-rw-r--r-- | TAO/tests/Bug_3251_Regression/server.cpp | 133 |
10 files changed, 637 insertions, 0 deletions
diff --git a/TAO/tests/Bug_3251_Regression/Bug_3251.conf b/TAO/tests/Bug_3251_Regression/Bug_3251.conf new file mode 100644 index 00000000000..5f0ce74d685 --- /dev/null +++ b/TAO/tests/Bug_3251_Regression/Bug_3251.conf @@ -0,0 +1,3 @@ +dynamic PersistentPOA Service_Object * Bug_3251:_make_DllOrb() "DllOrb -NumThreads 12 -ORBDottedDecimalAddresses 1 -ORBCollocationStrategy thru_poa" +dynamic PersistentPOA Service_Object * Bug_3251:_make_PersistentPoa() "PersistentPOA DllOrb" + diff --git a/TAO/tests/Bug_3251_Regression/Bug_3251.conf.xml b/TAO/tests/Bug_3251_Regression/Bug_3251.conf.xml new file mode 100644 index 00000000000..95a3df2a37f --- /dev/null +++ b/TAO/tests/Bug_3251_Regression/Bug_3251.conf.xml @@ -0,0 +1,30 @@ +<?xml version='1.0'?> +<ACE_Svc_Conf> + <!-- ACE will locate the libraries for you automatically by reading your LD --> + <!-- search path. Moreover, ACE will automatically insert the correct suffix --> + <!-- (e.g., ".dll", ".so", etc.). --> + + + <!-- ORB --> + <dynamic id="DllOrb" type="Service_Object"> + <!-- specify TS_ORB_ENDPOINT like this + TS_ORB_ENDPOINT="-ORBEndpoint iiop://aaa.bbb.ccc.ddd:nnnn" + + examples: + TS_ORB_ENDPOINT"-ORBEndpoint iiop://127.0.0.0" + TS_ORB_ENDPOINT"-ORBEndpoint iiop://:4200" + TS_ORB_ENDPOINT"-ORBEndpoint iiop://127.0.0.0:4200" + --> + <initializer path="Bug_3251" init="_make_DllOrb" params="DllOrb -NumThreads 12 -ORBDebugLevel $TS_ORB_DEBUGLEVEL $TS_ORB_ENDPOINT -ORBDottedDecimalAddresses 1 -ORBCollocationStrategy thru_poa"/> + </dynamic> + <!-- ORB --> + + + <!-- persistent POA --> + <dynamic id="PersistentPOA" type="Service_Object"> + <initializer path="Bug_3251" init="_make_PersistentPoa" params="PersistentPOA DllOrb"/> + </dynamic> + <!-- persistent POA --> + + +</ACE_Svc_Conf> diff --git a/TAO/tests/Bug_3251_Regression/Bug_3251_Regression.mpc b/TAO/tests/Bug_3251_Regression/Bug_3251_Regression.mpc new file mode 100644 index 00000000000..3f28ba17200 --- /dev/null +++ b/TAO/tests/Bug_3251_Regression/Bug_3251_Regression.mpc @@ -0,0 +1,18 @@ +// $Id$ + +project(*server) : taoserver { + after += *lib + Source_Files { + server.cpp + } +} + +project(*lib): taolib, portableserver { + libout = . + sharedname = Bug_3251 + dynamicflags += BUG_3251_BUILD_DLL + Source_Files { + DllOrb.cpp + PersistentPoa.cpp + } +} diff --git a/TAO/tests/Bug_3251_Regression/DllOrb.cpp b/TAO/tests/Bug_3251_Regression/DllOrb.cpp new file mode 100644 index 00000000000..8303370d3c5 --- /dev/null +++ b/TAO/tests/Bug_3251_Regression/DllOrb.cpp @@ -0,0 +1,176 @@ +// $Id$ + +#include "DllOrb.h" +#include "ace/Arg_Shifter.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/OS_NS_unistd.h" +#include "tao/TAO_Singleton_Manager.h" + + +DllOrb::DllOrb (void) + : + ma_barrier_(), + mv_orb_ (), + mv_rootPOA_ () +{ +} + + +DllOrb::~DllOrb (void) +{ +} + + +int +DllOrb::init (int argc, ACE_TCHAR *argv[]) +{ + int threadCnt = 1; + + try + { + ACE_Arg_Shifter as (argc, argv); + const ACE_TCHAR *currentArg = 0; + while (as.is_anything_left ()) + { + if (0 != (currentArg = as.get_the_parameter (ACE_TEXT ("-NumThreads")))) + { + int num = ACE_OS::atoi (currentArg); + if (num >= 1) + threadCnt = num; + as.consume_arg (); + } + else + as.ignore_arg (); + } + + // Initialize the ORB + ACE_Argv_Type_Converter argcon (argc, argv); + mv_orb_ = CORBA::ORB_init (argcon.get_argc (), argcon.get_ASCII_argv ()); + if (CORBA::is_nil (mv_orb_.in ())) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("nil ORB\n"))); + return -1; + } + + CORBA::Object_var v_poa = + mv_orb_->resolve_initial_references ("RootPOA"); + + mv_rootPOA_ = PortableServer::POA::_narrow (v_poa.in ()); + if (CORBA::is_nil (mv_rootPOA_.in ())) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("nil RootPOA\n"))); + return -1; + } + + mv_poaManager_ = mv_rootPOA_->the_POAManager (); + if (CORBA::is_nil (mv_poaManager_.in ())) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("nil POAManager\n"))); + return -1; + } + + mv_poaManager_->activate (); + } + catch (...) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: exception\n"))); + return -1; + } + + ma_barrier_ = std::auto_ptr < ACE_Thread_Barrier >( + new ACE_Thread_Barrier(threadCnt + 1) + ); + + this->activate( + THR_NEW_LWP|THR_JOINABLE|THR_INHERIT_SCHED, + threadCnt + ); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("init mp_barrier->wait() ...\n"))); + ma_barrier_->wait(); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("init mp_barrier->wait() done\n"))); + + return 0; +} + + +int +DllOrb::fini (void) +{ + try + { + mv_poaManager_->deactivate (1, 1); + mv_poaManager_ = PortableServer::POAManager::_nil (); + + // attempt to protect against sporadic BAD_INV_ORDER exceptions + ACE_OS::sleep (ACE_Time_Value (0, 500)); + + mv_orb_->shutdown (1); + + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("wait() ...\n"))); + // wait for our threads to finish + wait(); + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("wait() done\n"))); + + ma_barrier_.reset(); + } + catch (...) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: exception\n"))); + return -1; + } + + try + { + mv_orb_->destroy (); + mv_orb_ = CORBA::ORB::_nil (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return -1; + } + + return 0; +} + + +int DllOrb::svc (void) +{ + ACE_DEBUG ((LM_INFO, ACE_TEXT ("svc mp_barrier->wait() ...\n"))); + ma_barrier_->wait(); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("svc mp_barrier->wait() done\n"))); + + try + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("mv_orb->run ...\n"))); + try + { + mv_orb_->run(); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("mv_orb->run returned\n"))); + } + catch(CORBA::BAD_INV_ORDER const & rc_ex) + { + const CORBA::ULong VMCID = rc_ex.minor() & 0xFFFFF000U; + const CORBA::ULong minorCode = rc_ex.minor() & 0xFFFU; + if (VMCID == CORBA::OMGVMCID && minorCode == 4) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("ignored 'CORBA::BAD_INV_ORDER: ORB has shutdown.'\n"))); + } + else + { + throw; + } + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("mv_orb->run done\n"))); + } + catch(...) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Exception\n"))); + return -1; + } + + return 0; +} /* end of DllOrb::svc ( ) */ + + +ACE_FACTORY_DEFINE (bug_3251, DllOrb) diff --git a/TAO/tests/Bug_3251_Regression/DllOrb.h b/TAO/tests/Bug_3251_Regression/DllOrb.h new file mode 100644 index 00000000000..f8fe24bfba8 --- /dev/null +++ b/TAO/tests/Bug_3251_Regression/DllOrb.h @@ -0,0 +1,38 @@ +// $Id$ + +#ifndef bug_3251_DllORB_h +#define bug_3251_DllORB_h + +#include "ace/Auto_Ptr.h" +#include "ace/Barrier.h" +#include "ace/Task.h" +#include "tao/ORB.h" + +#include "tao/PortableServer/PortableServer.h" +#include "bug_3251_export.h" + + +class bug_3251_Export DllOrb: public ACE_Task_Base +{ +public: + DllOrb (void); + virtual ~DllOrb (void); + + CORBA::ORB_ptr orb (void) const { return CORBA::ORB::_duplicate(mv_orb_.in()); } + + virtual int init (int argc, ACE_TCHAR *argv[]); + + virtual int fini (void); + + virtual int svc (void); + +private: + auto_ptr < ACE_Thread_Barrier > ma_barrier_; + CORBA::ORB_var mv_orb_; + PortableServer::POA_var mv_rootPOA_; + PortableServer::POAManager_var mv_poaManager_; +}; + +ACE_FACTORY_DECLARE (bug_3251, DllOrb) + +#endif /* bug_3251_DllORB_h */ diff --git a/TAO/tests/Bug_3251_Regression/PersistentPoa.cpp b/TAO/tests/Bug_3251_Regression/PersistentPoa.cpp new file mode 100644 index 00000000000..8ad9e5f23cc --- /dev/null +++ b/TAO/tests/Bug_3251_Regression/PersistentPoa.cpp @@ -0,0 +1,104 @@ +// $Id$ + +#include "ace/Arg_Shifter.h" +#include "tao/PortableServer/POAManager.h" +#include "tao/PortableServer/PortableServer.h" + +#include "PersistentPoa.h" + +PersistentPoa::PersistentPoa ( ) +{ +} /* end of PersistentPoa::PersistentPoa ( ) */ + + +PersistentPoa::~PersistentPoa ( ) + throw () +{ +} /* end of PersistentPoa::~PersistentPoa ( ) */ + + +int PersistentPoa::init (int argc, char *argv[]) +{ + ACE_Arg_Shifter as(argc, argv); + m_poaName = std::string(as.get_current()); + as.ignore_arg(); + + std::string orbName(as.get_current()); + as.ignore_arg(); + + while(as.is_anything_left()) + { + as.ignore_arg(); + } + + try + { + // left out all safety checks + DllOrb * p_orb = ACE_Dynamic_Service<DllOrb>::instance (orbName.c_str()); + mv_orb = p_orb->orb(); + CORBA::Object_var v_poa = mv_orb->resolve_initial_references("RootPOA"); + mv_rootPOA = PortableServer::POA::_narrow(v_poa.in ()); + + // Threading policy + CORBA::Policy_var v_threadingPolicy = + mv_rootPOA->create_thread_policy(PortableServer::ORB_CTRL_MODEL); + + // Lifespan policy + CORBA::Policy_var v_lifespanPolicy = + mv_rootPOA->create_lifespan_policy(PortableServer::PERSISTENT); + + // ID assignment policy + CORBA::Policy_var v_idAssignmentPolicy = + mv_rootPOA->create_id_assignment_policy(PortableServer::USER_ID); + + // Policies for the new POA + CORBA::PolicyList policies(3); + policies.length (3); + policies[0] = v_threadingPolicy.in(); + policies[1] = v_lifespanPolicy.in(); + policies[2] = v_idAssignmentPolicy.in(); + + mv_thisPOA = mv_rootPOA->create_POA( + m_poaName.c_str(), + PortableServer::POAManager::_nil(), + policies + ); + + mv_poaManager = mv_thisPOA->the_POAManager(); + mv_poaManager->activate(); + } + catch(...) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("activate failed\n"))); + return -1; + } + + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("POA activated\n"))); + + return 0; +} /* end of PersistentPoa::init ( ) */ + + +int PersistentPoa::fini (void) +{ + try + { + mv_poaManager->deactivate(1, 1); + mv_poaManager = PortableServer::POAManager::_nil(); + + mv_thisPOA->destroy(1, 1); + mv_thisPOA = PortableServer::POA::_nil(); + } + catch(...) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("deactivate failed\n"))); + return -1; + } + + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("POA deactivated\n"))); + + return 0; +} /* end of PersistentPoa::fini ( ) */ + + +ACE_FACTORY_DEFINE (bug_3251, PersistentPoa) diff --git a/TAO/tests/Bug_3251_Regression/PersistentPoa.h b/TAO/tests/Bug_3251_Regression/PersistentPoa.h new file mode 100644 index 00000000000..dace9c4db7f --- /dev/null +++ b/TAO/tests/Bug_3251_Regression/PersistentPoa.h @@ -0,0 +1,46 @@ +// $Id$ + +#ifndef bug_3251_PersistentPoa_h +#define bug_3251_PersistentPoa_h + +#include <string> + +#include "ace/Service_Object.h" +#include "tao/ORB.h" +#include "tao/PortableServer/PortableServer.h" + +#include "DllOrb.h" +#include "bug_3251_export.h" + + +class PersistentPoa +: + public ACE_Service_Object +{ + // public types and methods + public: + PersistentPoa ( ); + + ~PersistentPoa ( ) + throw (); + + // protected types and methods + protected: + virtual int init (int argc, char *argv[]); + + virtual int fini (void); + + // private methods and instance variables + private: + std::string m_poaName; + CORBA::ORB_var mv_orb; + PortableServer::POA_var mv_rootPOA; + PortableServer::POA_var mv_thisPOA; + PortableServer::POAManager_var mv_poaManager; +}; /* end of class PersistentPoa */ + + +ACE_FACTORY_DECLARE (bug_3251, PersistentPoa) + + +#endif /* bug_3251_PersistentPoa_h */ diff --git a/TAO/tests/Bug_3251_Regression/bug_3251_export.h b/TAO/tests/Bug_3251_Regression/bug_3251_export.h new file mode 100644 index 00000000000..55e3d892fab --- /dev/null +++ b/TAO/tests/Bug_3251_Regression/bug_3251_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl bug_3251 +// ------------------------------ +#ifndef BUG_3251_REGRESSION_EXPORT_H +#define BUG_3251_REGRESSION_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (BUG_3251_REGRESSION_HAS_DLL) +# define BUG_3251_REGRESSION_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && BUG_3251_REGRESSION_HAS_DLL */ + +#if !defined (BUG_3251_REGRESSION_HAS_DLL) +# define BUG_3251_REGRESSION_HAS_DLL 1 +#endif /* ! BUG_3251_REGRESSION_HAS_DLL */ + +#if defined (BUG_3251_REGRESSION_HAS_DLL) && (BUG_3251_REGRESSION_HAS_DLL == 1) +# if defined (BUG_3251_REGRESSION_BUILD_DLL) +# define bug_3251_Export ACE_Proper_Export_Flag +# define BUG_3251_REGRESSION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BUG_3251_REGRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BUG_3251_REGRESSION_BUILD_DLL */ +# define bug_3251_Export ACE_Proper_Import_Flag +# define BUG_3251_REGRESSION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BUG_3251_REGRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BUG_3251_REGRESSION_BUILD_DLL */ +#else /* BUG_3251_REGRESSION_HAS_DLL == 1 */ +# define bug_3251_Export +# define BUG_3251_REGRESSION_SINGLETON_DECLARATION(T) +# define BUG_3251_REGRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BUG_3251_REGRESSION_HAS_DLL == 1 */ + +// Set BUG_3251_REGRESSION_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BUG_3251_REGRESSION_NTRACE) +# if (ACE_NTRACE == 1) +# define BUG_3251_REGRESSION_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BUG_3251_REGRESSION_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BUG_3251_REGRESSION_NTRACE */ + +#if (BUG_3251_REGRESSION_NTRACE == 1) +# define BUG_3251_REGRESSION_TRACE(X) +#else /* (BUG_3251_REGRESSION_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define BUG_3251_REGRESSION_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (BUG_3251_REGRESSION_NTRACE == 1) */ + +#endif /* BUG_3251_REGRESSION_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/tests/Bug_3251_Regression/run_test.pl b/TAO/tests/Bug_3251_Regression/run_test.pl new file mode 100644 index 00000000000..bacca8c802f --- /dev/null +++ b/TAO/tests/Bug_3251_Regression/run_test.pl @@ -0,0 +1,31 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::Run_Test; + +if (PerlACE::is_vxworks_test()) { + $SVP = new PerlACE::ProcessVX ("server", ""); +} +else { + $SVP = new PerlACE::Process ("server", ""); +} +# Run the AMH server. +$sv = $SVP->Spawn (); + +if ($sv != 0) { + print STDERR "ERROR: server returned $sv\n"; + exit 1; +} + +$svnk = $SVP->WaitKill (60); +if ($svnk != 0) { + print STDERR "ERROR: Server returned $svnk\n"; + $status = 1; +} + +exit $status; diff --git a/TAO/tests/Bug_3251_Regression/server.cpp b/TAO/tests/Bug_3251_Regression/server.cpp new file mode 100644 index 00000000000..06b04f7eaa1 --- /dev/null +++ b/TAO/tests/Bug_3251_Regression/server.cpp @@ -0,0 +1,133 @@ +// $Id$ + +#include "ace/ARGV.h" +#include "ace/OS.h" +#include "ace/Reactor.h" +#include "ace/Signal.h" +#include "ace/Service_Config.h" +#include "ace/Log_Msg.h" + +static volatile bool bShutdown = false; +static void shutdown(int) +{ + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Shutdown requested\n"))); + bShutdown = true; +} + +int +ACE_TMAIN(int argc, ACE_TCHAR ** argv) +{ + int result = 0; +#if defined (ACE_HAS_FORK) + ACE_Sig_Action sigUSR2((ACE_SignalHandler) shutdown, SIGUSR2); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("SIGUSR2 shutdown handler installed\n"))); + ACE_UNUSED_ARG(sigUSR2); + + pid_t pid = -1; + pid = ACE_OS::fork(); + if (pid == 0) // child + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("child waiting\n"))); + ACE_OS::sleep(5); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("signaling parent\n"))); + result = ACE_OS::kill(ACE_OS::getppid(), SIGUSR2); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("signaled parent\n"))); + return 0; + } + else if (pid > 0) // parent + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("parent using ACE_Service_Config\n"))); + ACE_Service_Config serviceConfig; + + char signum[64]; + ACE_OS::sprintf(signum, "%d", SIGUSR1); + + ACE_ARGV args; + args.add(argv[0]); + args.add("-s"); + args.add(signum); + + result = serviceConfig.open ( + args.argc(), + args.argv(), + ACE_DEFAULT_LOGGER_KEY, + 1, // ignore_static_svcs = 1, + 1, // ignore_default_svc_conf_file = 0, + 0 // ignore_debug_flag = 0 + ); + if(0 != result) + { + ACE_ERRROR ((LM_ERROR, ACE_TEXT ("Error: serviceConfig.open failed\n"))); + return result; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.open done\n"))); + + ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.process_file ...\n"))); +#if (ACE_USES_CLASSIC_SVC_CONF == 1) + result = serviceConfig.process_file("Bug_3251.conf"); +#else + result = serviceConfig.process_file("Bug_3251.conf.xml"); +#endif + if(0 != result) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error: serviceConfig.process_file failed\n"))); + return result; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.process_file done\n"))); + + ACE_DEBUG ((LM_INFO, ACE_TEXT ("run_event_loop ...\n"))); + while(!bShutdown) + { + ACE_OS::last_error(0); + result = ACE_Reactor::run_event_loop(); + // reenter loop on EINTR + if(0 != result && EINTR == ACE_OS::last_error()) + { + if(bShutdown) + break; + } + else if(0 != result) + { + ACE_DEBUG (( + LM_INFO, + ACE_TEXT ("run_event_loop failed (%s, %d)\n"), + ACE_OS::strerror(ACE_OS::last_error()), + ACE_OS::last_error() + )); + } + } + + ACE_DEBUG ((LM_INFO, ACE_TEXT ("run_event_loop done\n"))); + + ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.fini_svcs ...\n"))); + result = serviceConfig.fini_svcs(); + if(0 != result) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error: serviceConfig.fini_svcs failed\n"))); + return result; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.fini_svcs done\n"))); + + ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.close ...\n"))); + result = serviceConfig.close(); + if(0 != result) + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("Error: serviceConfig.close failed\n"))); + return result; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.close done\n"))); + + return result; + } /* end of if */ + else // fork failed + { + ACE_ERROR ((LM_ERROR, ACE_TEXT ("fork failed\n"))); + return 1; + } /* end of else */ +#else + ACE_UNUSED_ARG (argc); + ACE_UNUSED_ARG (argv); + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Fork not available\n"))); +#endif + return result; +} |