diff options
Diffstat (limited to 'ace/Acceptor.cpp')
-rw-r--r-- | ace/Acceptor.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ace/Acceptor.cpp b/ace/Acceptor.cpp index 7ad847eb71e..ac61481f17b 100644 --- a/ace/Acceptor.cpp +++ b/ace/Acceptor.cpp @@ -77,8 +77,7 @@ ACE_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open return -1; } - if (this->peer_acceptor_.open (local_addr, - reuse_addr) == -1) + if (this->peer_acceptor_.open (local_addr, reuse_addr) == -1) return -1; // Set the peer acceptor's handle into non-blocking mode. This is a @@ -551,6 +550,15 @@ ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open if (this->accept_strategy_->open (local_addr, 1) == -1) return -1; + // Set the peer acceptor's handle into non-blocking mode. This is a + // safe-guard against the race condition that can otherwise occur + // between the time when <select> indicates that a passive-mode + // socket handle is "ready" and when we call <accept>. During this + // interval, the client can shutdown the connection, in which case, + // the <accept> call can hang! + if (this->accept_strategy_->acceptor ().enable (ACE_NONBLOCK) != 0) + return -1; + // Initialize the concurrency strategy. if (con_s == 0) @@ -575,14 +583,6 @@ ACE_Strategy_Acceptor<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open this->use_select_ = use_select; - // Set the peer acceptor's handle into non-blocking mode. This is a - // safe-guard against the race condition that can otherwise occur - // between the time when <select> indicates that a passive-mode - // socket handle is "ready" and when we call <accept>. During this - // interval, the client can shutdown the connection, in which case, - // the <accept> call can hang! - this->peer_acceptor_.enable (ACE_NONBLOCK); - return this->reactor ()->register_handler (this, ACE_Event_Handler::ACCEPT_MASK); |