diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-09-02 16:31:27 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1998-09-02 16:31:27 +0000 |
commit | 29eed0cba078e78e3c109ddb591d349b36a67eb3 (patch) | |
tree | dd11ce632f91c6bcbf6aa8a30a89f93335385b2e /netsvcs | |
parent | 91c7073b31c7123fb551fdae3218aaf4f739d7b8 (diff) | |
download | ATCD-29eed0cba078e78e3c109ddb591d349b36a67eb3.tar.gz |
*** empty log message ***
Diffstat (limited to 'netsvcs')
-rw-r--r-- | netsvcs/lib/Name_Handler.cpp | 17 | ||||
-rw-r--r-- | netsvcs/lib/TS_Server_Handler.cpp | 57 | ||||
-rw-r--r-- | netsvcs/lib/Token_Handler.cpp | 10 |
3 files changed, 56 insertions, 28 deletions
diff --git a/netsvcs/lib/Name_Handler.cpp b/netsvcs/lib/Name_Handler.cpp index 8b2082f2f45..9edd7a6fe64 100644 --- a/netsvcs/lib/Name_Handler.cpp +++ b/netsvcs/lib/Name_Handler.cpp @@ -192,7 +192,8 @@ ACE_Name_Handler::abandon (void) { ACE_TRACE ("ACE_Name_Handler::abandon"); int failure_reason = errno; - return this->send_reply (ACE_Name_Reply::FAILURE, failure_reason); + return + this->send_reply (-1, failure_reason); } // Enable clients to limit the amount of time they'll wait @@ -347,8 +348,9 @@ ACE_Name_Handler::shared_bind (int rebind) result = 0; } if (result == 0) - return this->send_reply (ACE_Name_Reply::SUCCESS); - else return this->send_reply (ACE_Name_Reply::FAILURE); + return this->send_reply (0); + else + return this->send_reply (-1); } int @@ -367,7 +369,8 @@ ACE_Name_Handler::resolve (void) if (NAMING_CONTEXT::instance ()->resolve (a_name, avalue, atype) == 0) { ACE_Name_Request nrq (ACE_Name_Request::RESOLVE, - 0, 0, + 0, + 0, avalue.rep (), avalue.length () * sizeof (ACE_USHORT16), atype, ACE_OS::strlen (atype)); @@ -386,9 +389,11 @@ ACE_Name_Handler::unbind (void) ACE_DEBUG ((LM_DEBUG, "request for UNBIND \n")); ACE_WString a_name (this->name_request_.name (), this->name_request_.name_len () / sizeof (ACE_USHORT16)); + if (NAMING_CONTEXT::instance ()->unbind (a_name) == 0) - return this->send_reply (ACE_Name_Reply::SUCCESS); - else return this->send_reply (ACE_Name_Reply::FAILURE); + return this->send_reply (0); + else + return this->send_reply (-1); } ACE_Name_Request diff --git a/netsvcs/lib/TS_Server_Handler.cpp b/netsvcs/lib/TS_Server_Handler.cpp index 53ae05e6654..aa6999cdbec 100644 --- a/netsvcs/lib/TS_Server_Handler.cpp +++ b/netsvcs/lib/TS_Server_Handler.cpp @@ -52,9 +52,11 @@ ACE_TS_Server_Acceptor::init (int argc, char *argv[]) 0, 0, 0, &this->scheduling_strategy_, "Time Server", "ACE time service") == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%n: %p on port %d\n", + ACE_ERROR_RETURN ((LM_ERROR, + "%n: %p on port %d\n", "acceptor::open failed", - this->service_addr_.get_port_number ()), -1); + this->service_addr_.get_port_number ()), + -1); // Ignore SIGPIPE so that each <SVC_HANDLER> can handle this on its // own. @@ -65,7 +67,10 @@ ACE_TS_Server_Acceptor::init (int argc, char *argv[]) // Figure out what port we're really bound to. if (this->acceptor ().get_local_addr (server_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "get_local_addr"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "get_local_addr"), + -1); ACE_DEBUG ((LM_DEBUG, "starting up Time Server at port %d on handle %d\n", @@ -98,14 +103,22 @@ ACE_TS_Server_Handler::open (void *) // Determine the address of the client and display it. if (this->peer ().get_remote_addr (client_addr) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "get_remote_addr"), -1); - - ACE_DEBUG ((LM_DEBUG, "(%t) accepted connection from host %s on fd %d\n", - client_addr.get_host_name (), this->peer ().get_handle ())); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "get_remote_addr"), + -1); + + ACE_DEBUG ((LM_DEBUG, + "(%t) accepted connection from host %s on fd %d\n", + client_addr.get_host_name (), + this->peer ().get_handle ())); // Call down to our parent to register ourselves with the Reactor. if (ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>::open (0) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "open"), + -1); return 0; } @@ -113,17 +126,22 @@ ACE_TS_Server_Handler::open (void *) ACE_TS_Server_Handler::send_request (ACE_Time_Request &request) { ACE_TRACE ("ACE_TS_Server_Handler::send_request"); - void *buffer; + void *buffer; ssize_t length = request.encode (buffer); if (length == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "encode failed"), -1); + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "encode failed"), + -1); // Transmit request via a blocking send. if (this->peer ().send_n (buffer, length) != length) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send_n failed"), -1); - + ACE_ERROR_RETURN ((LM_ERROR, + "%p\n", + "send_n failed"), + -1); return 0; } @@ -137,7 +155,7 @@ ACE_TS_Server_Handler::abandon (void) // Note we are using the time field to report the errno in case of // failure. - ACE_Time_Request rq (ACE_Time_Request::FAILURE, errno); + ACE_Time_Request rq (-1, errno); return this->send_request (rq); } @@ -190,11 +208,15 @@ ACE_TS_Server_Handler::recv_request (void) /* FALLTHROUGH */ ACE_DEBUG ((LM_DEBUG, "****************** recv_request returned -1\n")); default: - ACE_ERROR ((LM_ERROR, "%p got %d bytes, expected %d bytes\n", - "recv failed", n, bytes_expected)); + ACE_ERROR ((LM_ERROR, + "%p got %d bytes, expected %d bytes\n", + "recv failed", + n, + bytes_expected)); /* FALLTHROUGH */ case 0: - // We've shutdown unexpectedly, let's abandon the connection. + // We've shutdown unexpectedly, let's abandon the + // connection. this->abandon (); return -1; /* NOTREACHED */ @@ -229,7 +251,8 @@ ACE_TS_Server_Handler::handle_input (ACE_HANDLE) ACE_TS_Server_Handler::~ACE_TS_Server_Handler (void) { ACE_TRACE ("ACE_TS_Server_Handler::~ACE_TS_Server_Handler"); - ACE_DEBUG ((LM_DEBUG, "closing down Handle %d\n", + ACE_DEBUG ((LM_DEBUG, + "closing down Handle %d\n", this->get_handle ())); } diff --git a/netsvcs/lib/Token_Handler.cpp b/netsvcs/lib/Token_Handler.cpp index 0e3bcbc4494..199e68763de 100644 --- a/netsvcs/lib/Token_Handler.cpp +++ b/netsvcs/lib/Token_Handler.cpp @@ -150,7 +150,7 @@ ACE_Token_Handler::acquire (ACE_Token_Proxy *proxy) return 0; } else // success - return this->send_reply (ACE_Token_Reply::SUCCESS); + return this->send_reply (0); } // Try to acquire the token. Never block. @@ -167,7 +167,7 @@ ACE_Token_Handler::try_acquire (ACE_Token_Proxy *proxy) if (proxy->tryacquire () == -1) return this->send_reply (errno); else - return this->send_reply (ACE_Token_Reply::SUCCESS); + return this->send_reply (0); } // Release the token and allow the next client that is waiting to @@ -192,7 +192,7 @@ ACE_Token_Handler::release (ACE_Token_Proxy *proxy) this->timeout_id_ = 0; } - return this->send_reply (ACE_Token_Reply::SUCCESS); + return this->send_reply (0); } // Yield the token if any clients are waiting, otherwise keep the @@ -231,7 +231,7 @@ ACE_Token_Handler::renew (ACE_Token_Proxy *proxy) } else // Success, we still hold the token. - return this->send_reply (ACE_Token_Reply::SUCCESS); + return this->send_reply (0); } /* VIRTUAL */ int @@ -477,7 +477,7 @@ ACE_Token_Handler::token_acquired (ACE_TPQ_Entry *) this->timeout_id_ = 0; } - this->send_reply (ACE_Token_Reply::SUCCESS); + this->send_reply (0); } int |