diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-10 06:48:50 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-10 06:48:50 +0000 |
commit | a0768bee9e4c83ff85c9924c002a4b95226200e2 (patch) | |
tree | 2cfe68fe5dc5aa19501ae60ccc0ee7e780ac5ded /ace/Service_Config.cpp | |
parent | b655af768c4ac7798ecf12021fdd2660b96f51b2 (diff) | |
download | ATCD-a0768bee9e4c83ff85c9924c002a4b95226200e2.tar.gz |
ChangeLogTag:Fri Mar 9 22:39:28 2001 Carlos O'Ryan <coryan@uci.edu>
Diffstat (limited to 'ace/Service_Config.cpp')
-rw-r--r-- | ace/Service_Config.cpp | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/ace/Service_Config.cpp b/ace/Service_Config.cpp index 2fdd9bcbf8e..1f9cd115cfa 100644 --- a/ace/Service_Config.cpp +++ b/ace/Service_Config.cpp @@ -492,6 +492,44 @@ ACE_Service_Config::process_commandline_directives (void) return result; } +int +ACE_Service_Config::process_directive (const ACE_Static_Svc_Descriptor &ssd, + int force_replace) +{ + if (!force_replace) + { + if (ACE_Service_Repository::instance ()->find (ssd.name_, + 0, 0) >= 0) + { + // The service is already there, just return + return 0; + } + } + + ACE_Service_Object_Exterminator gobbler; + void *sym = (ssd.alloc_)(&gobbler); + + ACE_Service_Type_Impl *stp = + ace_create_service_type (ssd.name_, + ssd.type_, + sym, + ssd.flags_, + gobbler); + if (stp == 0) + return 0; + + + ACE_Service_Type *service_type; + ACE_NEW_RETURN (service_type, + ACE_Service_Type (ssd.name_, + stp, + 0, + ssd.active_), + -1); + + return ACE_Service_Repository::instance ()->insert (service_type); +} + // Add the default statically-linked services to the Service // Repository. @@ -509,27 +547,7 @@ ACE_Service_Config::load_static_svcs (void) { ACE_Static_Svc_Descriptor *ssd = *ssdp; - ACE_Service_Object_Exterminator gobbler; - void *sym = (*ssd->alloc_)(&gobbler); - - ACE_Service_Type_Impl *stp = - ace_create_service_type (ssd->name_, - ssd->type_, - sym, - ssd->flags_, - gobbler); - if (stp == 0) - continue; - - ACE_Service_Type *sr; - - ACE_NEW_RETURN (sr, - ACE_Service_Type (ssd->name_, - stp, - 0, - ssd->active_), - -1); - if (ACE_Service_Repository::instance ()->insert (sr) == -1) + if (ACE_Service_Config::process_directive (*ssd, 1) == -1) return -1; } return 0; |