diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-01-29 03:38:03 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-01-29 03:38:03 +0000 |
commit | c01e57bb9e0e5e2e88bb885d24aa7b56bf0e0660 (patch) | |
tree | 8d4a84a99823b81ccd5f3ddd95c637d5561c52c1 | |
parent | 615d8bbbc5206958951f82fab0b48991a3be25a0 (diff) | |
download | ATCD-c01e57bb9e0e5e2e88bb885d24aa7b56bf0e0660.tar.gz |
lease
-rw-r--r-- | ChangeLog-97a | 11 | ||||
-rw-r--r-- | ace/OS.i | 11 | ||||
-rw-r--r-- | apps/Gateway/Gateway/consumer_config | 30 | ||||
-rw-r--r-- | apps/Gateway/Gateway/proxy_config | 27 | ||||
-rw-r--r-- | apps/Gateway/Peer/Peer.cpp | 32 | ||||
-rw-r--r-- | apps/Gateway/README | 5 |
6 files changed, 87 insertions, 29 deletions
diff --git a/ChangeLog-97a b/ChangeLog-97a index f73f4a90bba..ac2c45b1c0d 100644 --- a/ChangeLog-97a +++ b/ChangeLog-97a @@ -1,5 +1,16 @@ Tue Jan 28 16:49:44 1997 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> + * ace/OS.i (thr_setprio): Fixed a typo that was left over from a + previous change. Thanks to Fred LaBar + <flabar@fallschurch.esys.com> for reporting this. + + * apps/Gateway/Gateway/{proxy_config,consumer_config}: Added + comments to these config files so they are easier to understand. + Thanks to Chuck Gehr for motivating this. + + * apps/Gateway/Peer/Peer.cpp: Changed the name from connection_id_ + to proxy_id_, which is more accurate. + * apps/Gateway/Peer/Peer.cpp: Added a destructor to Peer_Handler so that it can clean itself up properly when shutdown with a signal. This fixes a nasty bug. @@ -3898,21 +3898,20 @@ ACE_OS::thr_setprio (ACE_hthread_t thr_id, int prio) int, -1); #elif (defined (ACE_HAS_DCETHREADS) || defined (ACE_HAS_PTHREADS)) && !defined (ACE_LACKS_SETSCHED) struct sched_param param; - int result; int policy = 0; param.sched_priority = prio; ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::pthread_setschedparam (thr_id, &policy, ¶m), - result), int, - -1, result); - return result; - ACE_NOTSUP_RETURN (-1); + ace_result_), + int, -1); #elif defined (ACE_HAS_WTHREADS) ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::SetThreadPriority (thr_id, prio), ace_result_), int, -1); #elif defined (VXWORKS) - ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::taskPrioritySet (thr_id, prio), ace_result_), int, -1); + ACE_OSCALL_RETURN (ACE_ADAPT_RETVAL (::taskPrioritySet (thr_id, prio), + ace_result_), + int, -1); #endif /* ACE_HAS_STHREADS */ #else ACE_NOTSUP_RETURN (-1); diff --git a/apps/Gateway/Gateway/consumer_config b/apps/Gateway/Gateway/consumer_config index d8a24001095..5f05972e5aa 100644 --- a/apps/Gateway/Gateway/consumer_config +++ b/apps/Gateway/Gateway/consumer_config @@ -1,19 +1,33 @@ # Configuration file for specifying which Consumers will receive -# messages from which Suppliers. +# events from which Suppliers. For now, the Gateway only allows +# Consumers to "subscribe" to receive events from particular +# Suppliers. A more flexible implementation will allow Consumers to +# subscribe to particular types of events, as well. # # Here's an explanation of the fields in this file, and how they # relate to fields in the "proxy_config" file. # -# 1. Proxy ID -# The conn +# 1. Proxy ID -- Each Proxy is given a unique ID that is used +# in the "consumer_config" file to specify to which Consumers +# the Event Channel will forward incoming events from Suppliers. +# The Proxy ID field is the "key" that is used to match up +# Consumer subscription requests in this file with Proxy +# connections in the "proxy_config" file. # -# 2. Supplier ID -# +# 2. Supplier ID -- Currently, this has the same meaning as the +# Proxy ID, though a more sophisticated implementation might change +# this... # -# 3. Type -# +# 3. Type -- Indicates the type of the event. Consumers +# can use this to only subscribe to certain types of events. This +# feature is currently not implemented. # -# 4. Consumers +# 4. Consumers -- Indicates which Consumers will receive events sent +# from this Proxy/Supplier ID, i.e., Consumers can subscribe to +# receive events from particular Suppliers. Note that more than +# one Consumer can subscribe to the same Supplier event, i.e., +# we support logical "multicast" (which is currently implemented +# using multi-point unicast via TCP/IP). # # Proxy ID Supplier ID Type Consumers # -------- ----------- ------- ------------ diff --git a/apps/Gateway/Gateway/proxy_config b/apps/Gateway/Gateway/proxy_config index 66b57770a54..fa4fcb13a91 100644 --- a/apps/Gateway/Gateway/proxy_config +++ b/apps/Gateway/Gateway/proxy_config @@ -4,6 +4,33 @@ # Here's an explanation of the fields in this file, and how they # relate to fields in the "consumer_config" file. # +# 1. Proxy ID -- Each Proxy is given a unique ID that is used +# in the "consumer_config" file to specify to which Consumers +# the Event Channel will forward incoming events from Suppliers. +# The Proxy ID field is the "key" that is used to match up Proxy +# connections in this file with the Consumer subscription requests +# in the "consumer_config" file. +# +# 2. Host -- The host name where the Supplier/Consumer peerd +# process is running. +# +# 3. Remote Port -- The port number where the remote +# Supplier/Consumer peerd process is listening on. +# +# 4. Proxy Role -- i.e., Consumer ('C') or Supplier ('S') +# +# 5. Max Retry Timeout -- The maximum amount of time that we'll +# wait between retry attempts (these start at 1 second and +# double until they reach the Max Retry Timeout). +# +# 6. Local Port -- The port number that we want to use for +# our local Proxy connection. If this is the value 0, then +# we'll let the socket implementation pick this value for us. +# +# 7. Priority -- Each Consumer/Supplier can be given a priority +# that will determine its importance relative to other +# Consumers/Suppliers (this feature isn't implemented yet). +# # Proxy Host Remote Proxy Max Retry Local Priority # ID Port Role Timeout Port # ---- -------- ------ ------ ---------- ----- -------- diff --git a/apps/Gateway/Peer/Peer.cpp b/apps/Gateway/Peer/Peer.cpp index a2fab817b37..a2d98aaf35b 100644 --- a/apps/Gateway/Peer/Peer.cpp +++ b/apps/Gateway/Peer/Peer.cpp @@ -67,8 +67,10 @@ protected: // channel!!!! This is clearly a policy in search of refinement... enum { MAX_QUEUE_SIZE = 1024 * 1024 * 16 }; - ACE_INT32 connection_id_; - // Supplier ID of the peer (obtained from gatewayd). + ACE_INT32 proxy_id_; + // Proxy ID of the peer (obtained from gatewayd). For simplicity, + // in this implementation we also use the Proxy ID as the Supplier + // ID. This might change in future releases. virtual int nonblk_put (ACE_Message_Block *mb); // Perform a non-blocking put(). @@ -99,7 +101,7 @@ protected: }; Peer_Handler::Peer_Handler (void) - : connection_id_ (0), + : proxy_id_ (0), msg_frag_ (0), total_bytes_ (0) { @@ -148,7 +150,7 @@ Peer_Handler::open (void *a) int Peer_Handler::xmit_stdin (void) { - if (this->connection_id_ != -1) + if (this->proxy_id_ != -1) { ACE_Message_Block *mb; @@ -177,9 +179,9 @@ Peer_Handler::xmit_stdin (void) ACE_ERROR ((LM_ERROR, "%p\n", "read")); break; default: - // For simplicity, we'll use our connection id as the supplier - // id (which we must store in network byte order). - event->header_.supplier_id_ = this->connection_id_; + // For simplicity, we'll use our proxy id as the supplier id + // (which we must store in network byte order). + event->header_.supplier_id_ = this->proxy_id_; event->header_.len_ = n; event->header_.priority_ = 0; event->header_.type_ = 0; @@ -226,7 +228,7 @@ Peer_Handler::nonblk_put (ACE_Message_Block *mb) { ACE_DEBUG ((LM_DEBUG, "queueing activated on handle %d to supplier id %d\n", - this->get_handle (), this->connection_id_)); + this->get_handle (), this->proxy_id_)); // ACE_Queue in *front* of the list to preserve order. if (this->msg_queue ()->enqueue_head @@ -285,7 +287,7 @@ Peer_Handler::handle_output (ACE_HANDLE) ACE_DEBUG ((LM_DEBUG, "queue now empty on handle %d to supplier id %d\n", this->get_handle (), - this->connection_id_)); + this->proxy_id_)); if (ACE_Service_Config::reactor ()->cancel_wakeup (this, ACE_Event_Handler::WRITE_MASK) == -1) @@ -489,10 +491,10 @@ Peer_Handler::handle_input (ACE_HANDLE sd) int Peer_Handler::await_supplier_id (void) { - ssize_t n = this->peer ().recv (&this->connection_id_, - sizeof this->connection_id_); + ssize_t n = this->peer ().recv (&this->proxy_id_, + sizeof this->proxy_id_); - if (n != sizeof this->connection_id_) + if (n != sizeof this->proxy_id_) { if (n == 0) ACE_ERROR_RETURN ((LM_ERROR, @@ -504,9 +506,9 @@ Peer_Handler::await_supplier_id (void) } else { - this->connection_id_ = ntohl (this->connection_id_); - ACE_DEBUG ((LM_DEBUG, "assigned connection id %d\n", - this->connection_id_)); + this->proxy_id_ = ntohl (this->proxy_id_); + ACE_DEBUG ((LM_DEBUG, "assigned proxy id %d\n", + this->proxy_id_)); } // Transition to the action that waits for Peer events. diff --git a/apps/Gateway/README b/apps/Gateway/README index ce0c97856be..7cded6e470c 100644 --- a/apps/Gateway/README +++ b/apps/Gateway/README @@ -48,6 +48,11 @@ Peer events forwarded by the Gateway (forwarding is based on the settings in the consumer_config configuration file). + Note that in the current implementation, the same Peer + process (peerd) cannot serve as both a Consumer and + Supplier of Events. Naturally, multiple peerd processes + can work together to play these different roles. + RUNNING THE TESTS To run the tests do the following: |