diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2006-12-07 13:48:13 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2006-12-07 13:48:13 +0000 |
commit | c8a11495ffc1e28d8da57a8e08161439b701bf57 (patch) | |
tree | 295a0e359e6a60803f5298e6e75eb7cc7688ece3 /CIAO | |
parent | 9b26a9aee4116eb2f1eacfb3c51ebb6545e54852 (diff) | |
download | ATCD-c8a11495ffc1e28d8da57a8e08161439b701bf57.tar.gz |
Thu Dec 7 13:47:57 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'CIAO')
-rw-r--r-- | CIAO/ChangeLog | 7 | ||||
-rw-r--r-- | CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.cpp | 60 |
2 files changed, 43 insertions, 24 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index 0d6e6d659f8..a756a4eacdb 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,10 @@ +Thu Dec 7 13:47:57 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl> + + * DAnCE/DomainApplicationManager/Deployment_Configuration (init): + Use ACE_Read_Buffer to read the file and parse it contents. This way + we are independent of a fixed buffer length, especially on systems + with multiple network cards and IPv6 enabled the IORs can get huge. + Thu Dec 7 11:48:57 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl> * ciao/CCM_Core.mpc: diff --git a/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.cpp b/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.cpp index ce6049aacdf..6cfbee8ee87 100644 --- a/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.cpp +++ b/CIAO/DAnCE/DomainApplicationManager/Deployment_Configuration.cpp @@ -1,10 +1,11 @@ // $Id$ #include "Deployment_Configuration.h" +#include "ciao/CIAO_common.h" #include "ace/OS_NS_stdio.h" - -const int NAME_BUFSIZE = 1024; +#include "ace/OS_NS_string.h" +#include "ace/Read_Buffer.h" CIAO::Deployment_Configuration::Deployment_Configuration (CORBA::ORB_ptr o) : orb_ (CORBA::ORB::_duplicate (o)) @@ -19,8 +20,6 @@ CIAO::Deployment_Configuration::~Deployment_Configuration (void) int CIAO::Deployment_Configuration::init (const char *filename) { - // @@ We should change to use ACE_Configuration here. - if (filename == 0) { ACE_ERROR ((LM_ERROR, "DANCE (%P|%t) Deployment_Configuration.cpp" @@ -34,29 +33,44 @@ CIAO::Deployment_Configuration::init (const char *filename) { ACE_ERROR_RETURN ((LM_ERROR, "DAnCE (%P|%t) Deployment_Configuration.cpp:" - "Fail to open node manager map data file: %s : \n", + "Fail to open node manager map data file: <%s>\n", filename), -1); } - char destination[NAME_BUFSIZE]; - char ior[NAME_BUFSIZE]; + // Get a read buffer, this will close the stream when we are ready + ACE_Read_Buffer reader (inf, true); + bool first = true; + char* string = 0; - while (fscanf (inf, "%s %s", destination, ior ) != EOF) + // Read from the file line by line + while ((string = reader.read ('\n', '\0')) != 0) { - // This should not fail!! - // - if (this->deployment_info_.bind (destination, ior) != 0) + // Search from the right to the first space + const char* ior_start = ACE_OS::strrchr (string, ' '); + // Search from the left to the first space + const char* dest_end = ACE_OS::strchr (string, ' '); + // The destination is first followed by some spaces + ACE_CString destination (string, dest_end - string); + // And then the IOR + ACE_CString ior (ior_start + 1, ACE_OS::strlen (ior_start + 1) - 1); + if (this->deployment_info_.bind (destination.c_str (), ior.c_str ()) != 0) { - ACE_OS::fclose (inf); ACE_ERROR_RETURN ((LM_ERROR, - "DAnCE (%P|%t) Deployment_Configuration.cpp:" - "Failed to bind destination [%s] : \n", + "DAnCE (%P|%t) Deployment_Configuration, " + "failed to bind destination <%s>\n", destination), -1); } + if (CIAO::debug_level () > 5) + { + ACE_DEBUG ((LM_DEBUG, + "DAnCE (%P|%t) Deployment_Configuration, " + "read <%s> <%s>\n", destination.c_str (), ior.c_str ())); + } + if (first) { this->default_node_manager_.IOR_ = ior; @@ -64,8 +78,6 @@ CIAO::Deployment_Configuration::init (const char *filename) } } - ACE_OS::fclose (inf); - return 0; } @@ -73,7 +85,7 @@ const char * CIAO::Deployment_Configuration::get_node_manager_ior (const char *name) const { if (name == 0) - return get_default_node_manager_ior (); + return this->get_default_node_manager_ior (); ACE_Hash_Map_Entry <ACE_CString, @@ -83,8 +95,8 @@ CIAO::Deployment_Configuration::get_node_manager_ior (const char *name) const entry) != 0) { ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) Deployment_Configuration.cpp:" - "Failed to find IOR for destination [%s] : \n", + "DAnCE (%P|%t) Deployment_Configuration, " + "get_node_manager_ior, failed to find IOR for destination <%s>\n", name)); return 0; } @@ -114,11 +126,11 @@ CIAO::Deployment_Configuration::get_node_manager (const char *name if (this->deployment_info_.find (ACE_CString (name), entry) != 0) { - ACE_ERROR ((LM_ERROR, - "DAnCE (%P|%t) Deployment_Configuration.cpp:" - "Failed to find IOR for destination [%s] : \n", - name)); - return 0; + ACE_ERROR_RETURN ((LM_ERROR, + "DAnCE (%P|%t) Deployment_Configuration.cpp:" + "Failed to find IOR for destination <%s>\n", + name), + 0); } if (CORBA::is_nil (entry->int_id_.node_manager_.in ())) |