diff options
Diffstat (limited to 'ace/TLI_Acceptor.cpp')
-rw-r--r-- | ace/TLI_Acceptor.cpp | 62 |
1 files changed, 24 insertions, 38 deletions
diff --git a/ace/TLI_Acceptor.cpp b/ace/TLI_Acceptor.cpp index 6c6b294f378..334ba81244f 100644 --- a/ace/TLI_Acceptor.cpp +++ b/ace/TLI_Acceptor.cpp @@ -22,7 +22,7 @@ class ACE_TLI_Request_Queue public: ACE_TLI_Request_Queue (void); - ACE_HANDLE open (ACE_HANDLE fd, int size); + ACE_HANDLE open (ACE_HANDLE fd, int size); int close (void); int enqueue (const char device[], int restart, int rwflag); @@ -42,7 +42,7 @@ public: // Declare the dynamic allocation hooks. private: - ACE_HANDLE handle_; + ACE_HANDLE handle_; int size_; int current_count_; ACE_TLI_Request *base_; @@ -123,8 +123,7 @@ static ACE_HANDLE open_new_endpoint (ACE_HANDLE listen_handle, const char dev[], struct t_call *callp, - int rwf, - ACE_Addr *remote_sap = 0) + int rwf) { ACE_TRACE ("open_new_endpoint"); #if defined (ACE_PSOS) @@ -137,18 +136,8 @@ open_new_endpoint (ACE_HANDLE listen_handle, 0); #endif /* ACE_PSOS */ - struct t_bind req, *req_p = 0; - if (remote_sap != 0) - { - req.qlen = 0; - req.addr.buf = (char *) remote_sap->get_addr (); - req.addr.len = remote_sap->get_size (); - req.addr.maxlen = remote_sap->get_size (); - req_p = &req; - } - if (fd == ACE_INVALID_HANDLE - || ACE_OS::t_bind (fd, req_p, 0) == -1) + || ACE_OS::t_bind (fd, 0, 0) == -1) fd = ACE_INVALID_HANDLE; #if defined (I_PUSH) && !defined (ACE_HAS_FORE_ATM_XTI) else if (rwf != 0 && ACE_OS::ioctl (fd, @@ -179,7 +168,7 @@ ACE_TLI_Request_Queue::close (void) item.handle_ = ACE_INVALID_HANDLE; if (ACE_OS::t_free ((char *) item.callp_, T_CALL) != 0) - res = -1; + res = -1; } delete [] this->base_; @@ -242,12 +231,12 @@ ACE_TLI_Request_Queue::enqueue (const char device[], do res = ACE_OS::t_listen (this->handle_, req.callp_); - while (res == -1 - && restart - && t_errno == TSYSERR + while (res == -1 + && restart + && t_errno == TSYSERR && errno == EINTR); - if (res != -1) + if (res != -1) { req.handle_ = open_new_endpoint (this->handle_, device, @@ -265,7 +254,7 @@ ACE_TLI_Request_Queue::enqueue (const char device[], // Something must have gone wrong, so free up allocated space. this->free (temp); - return -1; + return -1; } // Locate and remove SEQUENCE_NUMBER from the list of pending @@ -309,7 +298,7 @@ ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap, const char dev[]) { ACE_TRACE ("ACE_TLI_Acceptor::open"); - ACE_HANDLE res = 0; + ACE_HANDLE res = 0; int one = 1; this->disp_ = 0; @@ -331,7 +320,7 @@ ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap, && this->set_option (SOL_SOCKET, SO_REUSEADDR, &one, - sizeof one) == -1) + sizeof one) == -1) res = ACE_INVALID_HANDLE; #endif /* ACE_HAS_FORE_ATM_XTI */ else if ((this->disp_ = @@ -360,18 +349,19 @@ ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap, req.addr.len = 0; else { - req.addr.buf = (char *) remote_sap.get_addr (); req.addr.len = remote_sap.get_size (); + req.addr.buf = (char *) remote_sap.get_addr (); } - res = (ACE_HANDLE) ACE_OS::t_bind (this->get_handle (), - &req, - 0); + int bind_res = ACE_OS::t_bind (this->get_handle (), + &req, + 0); if (res != ACE_INVALID_HANDLE) + if (bind_res != -1) // Geisler: see above { ACE_NEW_RETURN (this->queue_, ACE_TLI_Request_Queue, - ACE_INVALID_HANDLE); + ACE_INVALID_HANDLE); res = this->queue_->open (this->get_handle (), this->backlog_); } @@ -474,20 +464,16 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap, do res = ACE_OS::t_listen (this->get_handle (), req->callp_); - while (res == -1 + while (res == -1 && restart && errno == EINTR); - if (res != -1) + if (res != -1) { - req->handle_ = open_new_endpoint (this->get_handle (), + req->handle_ = open_new_endpoint (this->get_handle (), this->device_, req->callp_, - rwf -#if defined (ACE_WIN32) - , remote_addr -#endif /* ACE_WIN32 */ - ); + rwf); if (req->handle_ == ACE_INVALID_HANDLE) res = -1; else @@ -506,7 +492,7 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap, (void *) opt, sizeof *opt); - while (res != -1) + while (res != -1) { res = ACE_OS::t_accept (this->get_handle (), req->handle_, @@ -519,7 +505,7 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap, res = 0; } - if (res == -1) + if (res == -1) { if (errno != EWOULDBLOCK) { |