diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-01-01 08:00:34 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-01-01 08:00:34 +0000 |
commit | ea0d28240863caf437a18071bfd03e7b146c5ade (patch) | |
tree | 91b695852b885a5f44f9be8c3a22bbf7f5a96b8d /apps/Gateway/Gateway/Proxy_Handler_Connector.cpp | |
parent | a6e2ced2f5279e011b712995095a1712a29e22f0 (diff) | |
download | ATCD-ea0d28240863caf437a18071bfd03e7b146c5ade.tar.gz |
foo
Diffstat (limited to 'apps/Gateway/Gateway/Proxy_Handler_Connector.cpp')
-rw-r--r-- | apps/Gateway/Gateway/Proxy_Handler_Connector.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/apps/Gateway/Gateway/Proxy_Handler_Connector.cpp b/apps/Gateway/Gateway/Proxy_Handler_Connector.cpp index 7ac0a77a2d4..dc18eca8500 100644 --- a/apps/Gateway/Gateway/Proxy_Handler_Connector.cpp +++ b/apps/Gateway/Gateway/Proxy_Handler_Connector.cpp @@ -18,15 +18,15 @@ Proxy_Handler_Connector::handle_close (ACE_HANDLE sd, ACE_Reactor_Mask) // Locate the ACE_Svc_Handler corresponding to the socket descriptor. if (this->handler_map_.find (sd, stp) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%t) can't locate channel %d in map, %p\n", + ACE_ERROR_RETURN ((LM_ERROR, "(%t) can't locate proxy %d in connector map, %p\n", sd, "find"), -1); - Proxy_Handler *channel = stp->svc_handler (); + Proxy_Handler *proxy_handler = stp->svc_handler (); // Schedule a reconnection request at some point in the future - // (note that channel uses an exponential backoff scheme). - if (ACE_Service_Config::reactor ()->schedule_timer (channel, 0, - channel->timeout ()) == -1) + // (note that proxy_handler uses an exponential backoff scheme). + if (ACE_Service_Config::reactor ()->schedule_timer + (proxy_handler, 0, proxy_handler->timeout ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "schedule_timer"), -1); return 0; @@ -35,36 +35,37 @@ Proxy_Handler_Connector::handle_close (ACE_HANDLE sd, ACE_Reactor_Mask) // Initiate (or reinitiate) a connection to the Proxy_Handler. int -Proxy_Handler_Connector::initiate_connection (Proxy_Handler *channel, - ACE_Synch_Options &synch_options) +Proxy_Handler_Connector::initiate_connection (Proxy_Handler *proxy_handler, + ACE_Synch_Options &synch_options) { - char buf[MAXHOSTNAMELEN]; + char addr_buf[MAXHOSTNAMELEN]; // Mark ourselves as idle so that the various iterators // will ignore us until we are reconnected. - channel->state (Proxy_Handler::IDLE); + proxy_handler->state (Proxy_Handler::IDLE); - if (channel->remote_addr ().addr_to_string (buf, sizeof buf) == -1 - || channel->local_addr ().addr_to_string (buf, sizeof buf) == -1) + // We check the remote addr second so that it remains in the addr_buf. + if (proxy_handler->local_addr ().addr_to_string (addr_buf, sizeof addr_buf) == -1 + || proxy_handler->remote_addr ().addr_to_string (addr_buf, sizeof addr_buf) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "can't obtain peer's address"), -1); // Try to connect to the Peer. - if (this->connect (channel, channel->remote_addr (), - synch_options, channel->local_addr ()) == -1) + if (this->connect (proxy_handler, proxy_handler->remote_addr (), + synch_options, proxy_handler->local_addr ()) == -1) { if (errno != EWOULDBLOCK) { - channel->state (Proxy_Handler::FAILED); + proxy_handler->state (Proxy_Handler::FAILED); ACE_DEBUG ((LM_DEBUG, "(%t) %p on address %s\n", - "connect", buf)); + "connect", addr_buf)); // Reschedule ourselves to try and connect again. if (synch_options[ACE_Synch_Options::USE_REACTOR]) { if (ACE_Service_Config::reactor ()->schedule_timer - (channel, 0, channel->timeout ()) == 0) + (proxy_handler, 0, proxy_handler->timeout ()) == 0) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "schedule_timer"), -1); } @@ -75,18 +76,18 @@ Proxy_Handler_Connector::initiate_connection (Proxy_Handler *channel, } else { - channel->state (Proxy_Handler::CONNECTING); + proxy_handler->state (Proxy_Handler::CONNECTING); ACE_DEBUG ((LM_DEBUG, "(%t) in the process of connecting %s to %s\n", synch_options[ACE_Synch_Options::USE_REACTOR] - ? "asynchronously" : "synchronously", buf)); + ? "asynchronously" : "synchronously", addr_buf)); } } else { - channel->state (Proxy_Handler::ESTABLISHED); + proxy_handler->state (Proxy_Handler::ESTABLISHED); ACE_DEBUG ((LM_DEBUG, "(%t) connected to %s on %d\n", - buf, channel->get_handle ())); + addr_buf, proxy_handler->get_handle ())); } return 0; } |