diff options
author | Ossama Othman <ossama-othman@users.noreply.github.com> | 1999-07-11 03:46:07 +0000 |
---|---|---|
committer | Ossama Othman <ossama-othman@users.noreply.github.com> | 1999-07-11 03:46:07 +0000 |
commit | 94b76ca7bf507ed3696c79d15df186ed45dbefb1 (patch) | |
tree | 521f23bb453a627225f2408f9e756bf776d0393b | |
parent | 675f22f5890681d9ce70e58bc12e37b711668a36 (diff) | |
download | ATCD-94b76ca7bf507ed3696c79d15df186ed45dbefb1.tar.gz |
Added an "unlink_on_close_" member that flags whether or not the
UIOP rendezvous point should be unlinked when closing the
acceptor. Currently this flag is only unset when an "address
already in use" error (EADDRINUSE) occurs. An existing
rendezvous point shouldn't be unlinked if errno == EADDRINUSE
since it may be in use by another UIOP server/client. [Bug 52]
Initialized a pointer to zero to prevent potential uninitialized
variable warnings.
Minor coding style updates.
-rw-r--r-- | TAO/tao/UIOP_Acceptor.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/TAO/tao/UIOP_Acceptor.cpp b/TAO/tao/UIOP_Acceptor.cpp index 1b10f6fa294..5db9c7af6f1 100644 --- a/TAO/tao/UIOP_Acceptor.cpp +++ b/TAO/tao/UIOP_Acceptor.cpp @@ -36,7 +36,8 @@ TAO_UIOP_Acceptor::TAO_UIOP_Acceptor (void) : TAO_Acceptor (TAO_IOP_TAG_UNIX_IOP), base_acceptor_ (), version_ (TAO_DEF_GIOP_MAJOR, TAO_DEF_GIOP_MINOR), - orb_core_ (0) + orb_core_ (0), + unlink_on_close_ (1) { } @@ -54,7 +55,7 @@ TAO_UIOP_Acceptor::create_mprofile (const TAO_ObjectKey &object_key, { ACE_UNIX_Addr addr; - if (base_acceptor_.acceptor ().get_local_addr (addr) == -1) + if (this->base_acceptor_.acceptor ().get_local_addr (addr) == -1) return 0; // we only make one @@ -65,7 +66,7 @@ TAO_UIOP_Acceptor::create_mprofile (const TAO_ObjectKey &object_key, return -1; } - TAO_UIOP_Profile *pfile; + TAO_UIOP_Profile *pfile = 0; ACE_NEW_RETURN (pfile, TAO_UIOP_Profile (addr, object_key, @@ -114,10 +115,11 @@ TAO_UIOP_Acceptor::close (void) { ACE_UNIX_Addr addr; - if (base_acceptor_.acceptor ().get_local_addr (addr) == -1) + if (this->base_acceptor_.acceptor ().get_local_addr (addr) == -1) return -1; - (void) ACE_OS::unlink (addr.get_path_name ()); + if (this->unlink_on_close_) + (void) ACE_OS::unlink (addr.get_path_name ()); return this->base_acceptor_.close (); } @@ -157,7 +159,14 @@ TAO_UIOP_Acceptor::open_i (TAO_ORB_Core* orb_core, this->rendezvous_point (addr, rendezvous); if (this->base_acceptor_.open (orb_core, addr) != 0) - return -1; + { + // Don't unlink an existing rendezvous point since it may be in + // use by another UIOP server/client. + if (errno == EADDRINUSE) + this->unlink_on_close_ = 0; + + return -1; + } // @@ If Profile creation is slow we may need to cache the // rendezvous point here |