diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-06-26 22:22:00 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-06-26 22:22:00 +0000 |
commit | 21bcb5c01dec9f2a48508d32ed81105a1f572a39 (patch) | |
tree | 0179d1b62c0d265155bc983f163d85b9bf40d953 | |
parent | 6cc7a3cb585b1327e989fc6c53d48dce6b41a9a5 (diff) | |
download | ATCD-21bcb5c01dec9f2a48508d32ed81105a1f572a39.tar.gz |
ChangeLogTag:Tue Jun 26 16:22:24 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
-rw-r--r-- | ace/TLI_Acceptor.cpp | 79 | ||||
-rw-r--r-- | ace/TLI_Connector.cpp | 2 | ||||
-rw-r--r-- | ace/TLI_Stream.cpp | 26 |
3 files changed, 60 insertions, 47 deletions
diff --git a/ace/TLI_Acceptor.cpp b/ace/TLI_Acceptor.cpp index 3002c54bdc4..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); - int open (int fd, int size); + ACE_HANDLE open (ACE_HANDLE fd, int size); int close (void); int enqueue (const char device[], int restart, int rwflag); @@ -42,9 +42,9 @@ public: // Declare the dynamic allocation hooks. private: - int handle_; - int size_; - int current_count_; + ACE_HANDLE handle_; + int size_; + int current_count_; ACE_TLI_Request *base_; ACE_TLI_Request *tail_; ACE_TLI_Request *free_list_; @@ -137,7 +137,7 @@ open_new_endpoint (ACE_HANDLE listen_handle, #endif /* ACE_PSOS */ if (fd == ACE_INVALID_HANDLE - || ACE_OS::t_bind (fd, 0, 0) == ACE_INVALID_HANDLE) + || 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, @@ -168,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 = ACE_INVALID_HANDLE; + res = -1; } delete [] this->base_; @@ -231,12 +231,12 @@ ACE_TLI_Request_Queue::enqueue (const char device[], do res = ACE_OS::t_listen (this->handle_, req.callp_); - while (res == ACE_INVALID_HANDLE + while (res == -1 && restart && t_errno == TSYSERR && errno == EINTR); - if (res != ACE_INVALID_HANDLE) + if (res != -1) { req.handle_ = open_new_endpoint (this->handle_, device, @@ -254,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 ACE_INVALID_HANDLE; + return -1; } // Locate and remove SEQUENCE_NUMBER from the list of pending @@ -298,7 +298,7 @@ ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap, const char dev[]) { ACE_TRACE ("ACE_TLI_Acceptor::open"); - int res = 0; + ACE_HANDLE res = 0; int one = 1; this->disp_ = 0; @@ -320,7 +320,7 @@ ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap, && this->set_option (SOL_SOCKET, SO_REUSEADDR, &one, - sizeof one) == ACE_INVALID_HANDLE) + sizeof one) == -1) res = ACE_INVALID_HANDLE; #endif /* ACE_HAS_FORE_ATM_XTI */ else if ((this->disp_ = @@ -353,14 +353,15 @@ ACE_TLI_Acceptor::open (const ACE_Addr &remote_sap, req.addr.buf = (char *) remote_sap.get_addr (); } - res = 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, - -1); + ACE_INVALID_HANDLE); res = this->queue_->open (this->get_handle (), this->backlog_); } @@ -385,8 +386,8 @@ ACE_TLI_Acceptor::ACE_TLI_Acceptor (const ACE_Addr &remote_sap, back, dev) == ACE_INVALID_HANDLE) ACE_ERROR ((LM_ERROR, - ACE_LIB_TEXT ("%p\n"), - ACE_LIB_TEXT ("ACE_TLI_Acceptor::ACE_TLI_Acceptor"))); + ACE_TEXT ("%p\n"), + ACE_TEXT ("ACE_TLI_Acceptor::ACE_TLI_Acceptor"))); } int @@ -451,7 +452,6 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap, ACE_TLI_Request *req = 0; int res = 0; - if (timeout != 0 && ACE::handle_timed_accept (this->get_handle (), timeout, @@ -463,16 +463,22 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap, do res = ACE_OS::t_listen (this->get_handle (), - req->callp_); - while (res == ACE_INVALID_HANDLE + req->callp_); + while (res == -1 && restart && errno == EINTR); - if (res != ACE_INVALID_HANDLE) - res = req->handle_ = open_new_endpoint (this->get_handle (), - this->device_, - req->callp_, - rwf); + if (res != -1) + { + req->handle_ = open_new_endpoint (this->get_handle (), + this->device_, + req->callp_, + rwf); + if (req->handle_ == ACE_INVALID_HANDLE) + res = -1; + else + res = 0; + } } else res = this->queue_->dequeue (req); @@ -486,17 +492,20 @@ ACE_TLI_Acceptor::accept (ACE_TLI_Stream &new_tli_sap, (void *) opt, sizeof *opt); - while (res != ACE_INVALID_HANDLE) - if ((res = ACE_OS::t_accept (this->get_handle (), - req->handle_, - req->callp_)) != ACE_INVALID_HANDLE) - break; // Got one! - else if (t_errno == TLOOK) - res = this->handle_async_event (restart, rwf); - else if (restart && t_errno == TSYSERR && errno == EINTR) - res = 0; + while (res != -1) + { + res = ACE_OS::t_accept (this->get_handle (), + req->handle_, + req->callp_); + if (res != -1) + break; // Got one! + else if (t_errno == TLOOK) + res = this->handle_async_event (restart, rwf); + else if (restart && t_errno == TSYSERR && errno == EINTR) + res = 0; + } - if (res == ACE_INVALID_HANDLE) + if (res == -1) { if (errno != EWOULDBLOCK) { diff --git a/ace/TLI_Connector.cpp b/ace/TLI_Connector.cpp index 4eb7258ab32..f6e93cd8935 100644 --- a/ace/TLI_Connector.cpp +++ b/ace/TLI_Connector.cpp @@ -49,7 +49,7 @@ ACE_TLI_Connector::connect (ACE_TLI_Stream &new_stream, // Only open a new endpoint if we don't already have a valid handle. if (new_stream.get_handle () == ACE_INVALID_HANDLE - && new_stream.open (device, flags, info) == ACE_INVALID HANDLE) + && new_stream.open (device, flags, info) == ACE_INVALID_HANDLE) return -1; if (local_sap != ACE_Addr::sap_any) diff --git a/ace/TLI_Stream.cpp b/ace/TLI_Stream.cpp index 6804c19d8b9..548aaf612c0 100644 --- a/ace/TLI_Stream.cpp +++ b/ace/TLI_Stream.cpp @@ -58,18 +58,19 @@ ACE_TLI_Stream::active_close (void) ACE_TRACE ("ACE_TLI_Stream::active_close"); char buf; - if (this->sndrel () == ACE_INVALID_HANDLE) - return ACE_INVALID_HANDLE; - if (this->recv (&buf, sizeof buf) == ACE_INVALID_HANDLE) + if (this->sndrel () == -1) + return -1; + else if (this->recv (&buf, sizeof buf) == -1) { if (t_errno == TLOOK && this->look () == T_ORDREL) { - if (this->rcvrel () == ACE_INVALID_HANDLE) - return ACE_INVALID_HANDLE; + if (this->rcvrel () == -1) + return -1; } else - return ACE_INVALID_HANDLE; + return -1; } + return this->close (); } @@ -80,10 +81,12 @@ int ACE_TLI_Stream::passive_close (void) { ACE_TRACE ("ACE_TLI_Stream::passive_close"); - if (this->rcvrel () == ACE_INVALID_HANDLE) - return ACE_INVALID_HANDLE; - if (this->sndrel () == ACE_INVALID_HANDLE) - return ACE_INVALID_HANDLE; + + if (this->rcvrel () == -1) + return -1; + else if (this->sndrel () == -1) + return -1; + return this->close (); } @@ -91,7 +94,8 @@ int ACE_TLI_Stream::close (void) { ACE_TRACE ("ACE_TLI_Stream::close"); - int fd = this->get_handle (); + + ACE_HANDLE fd = this->get_handle (); this->set_handle (ACE_INVALID_HANDLE); |