diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-31 21:48:20 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-31 21:48:20 +0000 |
commit | 86c5f836d1a679208716a422839d7da38ba41059 (patch) | |
tree | 1b3da514a0eb2064d0b27c62011db9492387b7dc /netsvcs | |
parent | 13c10349a654c59c85bb62c7f7b9ab8e1424814c (diff) | |
download | ATCD-86c5f836d1a679208716a422839d7da38ba41059.tar.gz |
added ACE_HAS_INSTANTIATION_PRAGMA support
Diffstat (limited to 'netsvcs')
-rw-r--r-- | netsvcs/clients/Naming/Client/Client_Test.cpp | 87 | ||||
-rw-r--r-- | netsvcs/clients/Tokens/manual/manual.cpp | 36 | ||||
-rw-r--r-- | netsvcs/lib/Client_Logging_Handler.cpp | 71 | ||||
-rw-r--r-- | netsvcs/lib/Name_Handler.cpp | 105 | ||||
-rw-r--r-- | netsvcs/lib/Server_Logging_Handler.cpp | 123 | ||||
-rw-r--r-- | netsvcs/lib/TS_Clerk_Handler.cpp | 114 | ||||
-rw-r--r-- | netsvcs/lib/TS_Server_Handler.cpp | 52 | ||||
-rw-r--r-- | netsvcs/lib/Token_Handler.cpp | 101 |
8 files changed, 418 insertions, 271 deletions
diff --git a/netsvcs/clients/Naming/Client/Client_Test.cpp b/netsvcs/clients/Naming/Client/Client_Test.cpp index 36fd6ba1317..e26416f7459 100644 --- a/netsvcs/clients/Naming/Client/Client_Test.cpp +++ b/netsvcs/clients/Naming/Client/Client_Test.cpp @@ -13,70 +13,70 @@ public: int open (void); // Cache reactor and then register self with reactor - + int close (void); // Close things down and free up resources. - + virtual int handle_input (ACE_HANDLE handle); // Handle user entered commands virtual int init (int argc, char *argv[]); // Initialize name options and naming context when dynamically // linked. - + virtual int fini (void); // Close down the test when dynamically unlinked. - + void list_options (void); // Print name options - + int bind (char *key, char *value, char *type = ""); // Bind a key to a value - + int unbind (char *key); // Unbind a name binding - + int rebind (char *key, char *value, char *type = ""); // Rebind a name binding - + int find (char *key); // Find the value associated with a key - + int list_names (char *pattern); // Find all names that match pattern - + int list_values (char *pattern); // Find all values that match pattern - + int list_types (char *pattern); // Find all types that match pattern - + int list_name_entries (char *pattern); // Find all names that match pattern - + int list_value_entries (char *pattern); // Find all values that match pattern int list_type_entries (char *pattern); // Find all types that match pattern - + private: ACE_Name_Options *name_options_; // Name Options associated with the Naming Context - + void display_menu (void); // Display user menu - + int set_proc_local (void); // Set options to use PROC_LOCAL naming context - + int set_node_local (void); // Set options to use NODE_LOCAL naming context - + int set_host (char *hostname, int port); - // Set options to use NET_LOCAL naming context + // Set options to use NET_LOCAL naming context // specifying host name and port number - + int quit (void); // Gracefully exit }; @@ -103,7 +103,7 @@ Client_Test::Client_Test (void) ACE_DEBUG ((LM_DEBUG, "Client_Test::Client_Test\n")); } -int +int Client_Test::init (int /* argc */, char * /* argv */ []) { ACE_DEBUG ((LM_DEBUG, "Client_Test::init\n")); @@ -130,12 +130,12 @@ int Client_Test::close (void) { // Deregister this handler with the ACE_Reactor. - return ACE_Reactor::instance ()->remove_handler - (ACE_STDIN, + return ACE_Reactor::instance ()->remove_handler + (ACE_STDIN, ACE_Event_Handler::DONT_CALL | ACE_Event_Handler::READ_MASK); } -int +int Client_Test::fini (void) { ACE_DEBUG ((LM_DEBUG, "Client_Test::fini\n")); @@ -155,10 +155,10 @@ Client_Test::handle_input (ACE_HANDLE) if (::scanf ("%s", option) <= 0) { - ACE_ERROR_RETURN ((LM_ERROR, "%p Try again!\n", + ACE_ERROR_RETURN ((LM_ERROR, "%p Try again!\n", "Client_Test::handle_input"), 0); } - + int result = -1; switch (isupper (option[0]) ? tolower (option[0]) : option[0]) @@ -316,7 +316,7 @@ Client_Test::display_menu (void) void Client_Test::list_options (void) { -// ACE_DEBUG ((LM_DEBUG, " *** Process Name is %s ***\n", +// ACE_DEBUG ((LM_DEBUG, " *** Process Name is %s ***\n", // this->name_options_->process_name ())); switch (this->name_options_->context ()) { @@ -327,16 +327,16 @@ Client_Test::list_options (void) ACE_DEBUG ((LM_DEBUG, " *** Using Node Local Database\n")); break; case ACE_Naming_Context::NET_LOCAL: - ACE_DEBUG ((LM_DEBUG, " *** Hostname: %s\n", + ACE_DEBUG ((LM_DEBUG, " *** Hostname: %s\n", this->name_options_->nameserver_host ())); - ACE_DEBUG ((LM_DEBUG, " *** Port Number: %d\n", + ACE_DEBUG ((LM_DEBUG, " *** Port Number: %d\n", this->name_options_->nameserver_port ())); break; - default: + default: assert (!"shouldn't occur!\n"); /* NOTREACHED */ } - ACE_DEBUG ((LM_DEBUG, " *** Namespace directory is %s ***\n", + ACE_DEBUG ((LM_DEBUG, " *** Namespace directory is %s ***\n", this->name_options_->namespace_dir ())); } @@ -360,7 +360,7 @@ Client_Test::set_node_local (void) return NAMING_CONTEXT ()->open (ACE_Naming_Context::NODE_LOCAL); } -int +int Client_Test::set_host (char* hostname, int port) { // Close down original name space @@ -370,18 +370,18 @@ Client_Test::set_host (char* hostname, int port) // Set Name Options this->name_options_->nameserver_host (hostname); this->name_options_->nameserver_port (port); - + return NAMING_CONTEXT ()->open (ACE_Naming_Context::NET_LOCAL); } -int +int Client_Test::quit (void) { // Send ourselves a SIGINT! return ACE_OS::kill (ACE_OS::getpid (), SIGINT); } -int +int Client_Test::bind (char* key, char* value, char* type) { if (NAMING_CONTEXT ()->bind (key, value, type) != 0) @@ -390,7 +390,7 @@ Client_Test::bind (char* key, char* value, char* type) return 0; } -int +int Client_Test::unbind (char* key) { if (NAMING_CONTEXT ()->unbind (key) != 0) @@ -399,7 +399,7 @@ Client_Test::unbind (char* key) return 0; } -int +int Client_Test::rebind (char* key, char* value, char* type) { int result = NAMING_CONTEXT ()->rebind (key, value, type ); @@ -540,7 +540,7 @@ Client_Test::list_type_entries (char *pattern) } -int +int Client_Test::find (char *key) { char *value = 0; @@ -551,8 +551,8 @@ Client_Test::find (char *key) "Client_Test::list_find", key), 0); else { - ACE_DEBUG ((LM_DEBUG, - "Binding for %s : value = %s\ttype = %s\n", + ACE_DEBUG ((LM_DEBUG, + "Binding for %s : value = %s\ttype = %s\n", key, value, type)); if (type) delete [] type; @@ -561,6 +561,9 @@ Client_Test::find (char *key) } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Dynamic_Service<ACE_Naming_Context>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Dynamic_Service<ACE_Naming_Context> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/netsvcs/clients/Tokens/manual/manual.cpp b/netsvcs/clients/Tokens/manual/manual.cpp index de9282ffc21..37ea73eaf15 100644 --- a/netsvcs/clients/Tokens/manual/manual.cpp +++ b/netsvcs/clients/Tokens/manual/manual.cpp @@ -4,7 +4,7 @@ // // = LIBRARY // examples -// +// // = FILENAME // manual.cpp // @@ -13,7 +13,7 @@ // // = AUTHOR // Tim Harrison -// +// // ============================================================================ #include "ace/OS.h" @@ -42,7 +42,7 @@ public: int parse_args (int argc, char *argv[]); // Parse command-line arguments. - + int open (int argc, char *argv[]); // Register with whatever event dispatcher is needed and run. @@ -78,7 +78,7 @@ private: COLLECTIONS collections_; // A collection for each <tid>. - + char *server_host_; int server_port_; int ignore_deadlock_; @@ -93,7 +93,7 @@ STDIN_Token::STDIN_Token (void) debug_ (0), remote_ (0) { -} +} int STDIN_Token::parse_args (int argc, char *argv[]) @@ -123,7 +123,7 @@ STDIN_Token::parse_args (int argc, char *argv[]) case 'u': // usage: fallthrough default: - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, "%n:\n" "[-h <remote host>]\n" "[-p <remote port>]\n" @@ -146,18 +146,18 @@ STDIN_Token::open (int argc, char *argv[]) return -1; // Register for signals. - if (ACE_Reactor::instance ()->register_handler + if (ACE_Reactor::instance ()->register_handler (SIGINT, this) == -1) ACE_DEBUG ((LM_DEBUG, "Can't register signal handler\n")); #if (ACE_WIN32) - + #else // Register for STDIN events with Reactor. if (ACE_Reactor::instance ()->register_handler (ACE_STDIN, this, ACE_Event_Handler::READ_MASK) == -1) ACE_ERROR_RETURN ((LM_DEBUG, "Can't register signal handler\n"), 0); - + #endif /* ACE_WIN32 */ @@ -165,7 +165,7 @@ STDIN_Token::open (int argc, char *argv[]) this->display_menu (); #if (ACE_WIN32) - + #else ACE_Reactor::run_event_loop (); #endif /* ACE_WIN32 */ @@ -174,7 +174,7 @@ STDIN_Token::open (int argc, char *argv[]) return 0; } -int +int STDIN_Token::handle_input (ACE_HANDLE fd) { ACE_UNUSED_ARG (fd); @@ -189,8 +189,8 @@ STDIN_Token::handle_input (ACE_HANDLE fd) ACE_OS::printf ("Try again.\n"); return 0; } - - ACE_Token_Proxy *proxy = + + ACE_Token_Proxy *proxy = this->get_proxy (tid, token, type[0]); if (proxy == 0) @@ -255,7 +255,7 @@ STDIN_Token::display_menu (void) ACE_OS::printf ("<tid> <token> <type> <operation>\n"); } -int +int STDIN_Token::handle_exception (ACE_HANDLE fd) { ACE_UNUSED_ARG (fd); @@ -352,7 +352,11 @@ main (int argc, char* argv[]) return st.open (argc, argv); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Map_Entry<STDIN_Token::TID, ACE_Token_Collection *>; template class ACE_Map_Manager<STDIN_Token::TID, ACE_Token_Collection *, ACE_Null_Mutex>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Map_Entry<STDIN_Token::TID, ACE_Token_Collection *> +#pragma instantiate ACE_Map_Manager<STDIN_Token::TID, ACE_Token_Collection *, ACE_Null_Mutex> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/netsvcs/lib/Client_Logging_Handler.cpp b/netsvcs/lib/Client_Logging_Handler.cpp index 53f94af6c36..0135eb3a96d 100644 --- a/netsvcs/lib/Client_Logging_Handler.cpp +++ b/netsvcs/lib/Client_Logging_Handler.cpp @@ -21,9 +21,9 @@ ACE_Client_Logging_Handler::ACE_Client_Logging_Handler (const char rendezvous[]) else if (ACE_Reactor::instance ()->register_handler (this->message_fifo_.get_handle (), this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::EXCEPT_MASK) == -1) - ACE_ERROR ((LM_ERROR, "%n: %p\n", + ACE_ERROR ((LM_ERROR, "%n: %p\n", "register_handler (message_fifo)")); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "opened fifo at %s on handle %d\n", rendezvous, this->message_fifo_.get_handle ())); @@ -38,7 +38,7 @@ ACE_Client_Logging_Handler::handle_signal (int, siginfo_t *, ucontext_t *) return -1; } -int +int ACE_Client_Logging_Handler::open (void *) { ACE_INET_Addr server_addr; @@ -49,15 +49,15 @@ ACE_Client_Logging_Handler::open (void *) // reconnections. #if !defined (ACE_WIN32) if (ACE_Reactor::instance ()->register_handler (SIGPIPE, this) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%n: %p\n", + ACE_ERROR_RETURN ((LM_ERROR, "%n: %p\n", "register_handler (SIGPIPE)"), -1); #endif /* ACE_WIN32 */ // Figure out what remote port we're really bound to. if (this->peer ().get_remote_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "get_remote_addr"), -1); - - ACE_DEBUG ((LM_DEBUG, + + ACE_DEBUG ((LM_DEBUG, "starting up Client Logging Daemon, " "connected to port %d on handle %d\n", server_addr.get_port_number (), @@ -65,7 +65,7 @@ ACE_Client_Logging_Handler::open (void *) return 0; } -/* VIRTUAL */ ACE_HANDLE +/* VIRTUAL */ ACE_HANDLE ACE_Client_Logging_Handler::get_handle (void) const { ACE_TRACE ("ACE_Client_Logging_Handler::get_handle"); @@ -100,7 +100,7 @@ ACE_Client_Logging_Handler::handle_input (ACE_HANDLE handle) return 0; } -// Receive a logging record from an application send via a non-0 MSG_BAND... +// Receive a logging record from an application send via a non-0 MSG_BAND... // This just calls handle_input(). int @@ -111,17 +111,17 @@ ACE_Client_Logging_Handler::handle_exception (ACE_HANDLE handle) // Called when object is removed from the ACE_Reactor -int +int ACE_Client_Logging_Handler::close (u_long) { ACE_DEBUG ((LM_DEBUG, "shutting down!!!\n")); if (ACE_Reactor::instance ()->remove_handler - (this->message_fifo_.get_handle (), + (this->message_fifo_.get_handle (), ACE_Event_Handler::READ_MASK | ACE_Event_Handler::EXCEPT_MASK | ACE_Event_Handler::DONT_CALL) == -1) - ACE_ERROR ((LM_ERROR, "%n: %p\n", + ACE_ERROR ((LM_ERROR, "%n: %p\n", "remove_handler (message_fifo)")); - + this->message_fifo_.close (); this->destroy (); return 0; @@ -136,7 +136,7 @@ ACE_Client_Logging_Handler::handle_output (ACE_HANDLE) // Encodes the contents of log_record object using network byte-order // and sends it to the logging server. -int +int ACE_Client_Logging_Handler::send (ACE_Log_Record &log_record) { if (this->logging_output_ == ACE_STDOUT) @@ -145,10 +145,10 @@ ACE_Client_Logging_Handler::send (ACE_Log_Record &log_record) { long len = log_record.length (); long encoded_len = htonl (len); - + log_record.encode (); - if (this->peer ().send (4, &encoded_len, sizeof encoded_len, + if (this->peer ().send (4, &encoded_len, sizeof encoded_len, (char *) &log_record, len) == -1) // Switch over to logging to stdout for now. In the long // run, we'll need to queue up the message, try to @@ -179,18 +179,18 @@ protected: // = Scheduling hooks. virtual int suspend (void); virtual int resume (void); - + private: int parse_args (int argc, char *argv[]); // Parse svc.conf arguments. const char *server_host_; // Host where the logging server is located. - + u_short server_port_; // Port number where the logging server is listening for // connections. - + ACE_INET_Addr server_addr_; // Address of the logging server. @@ -202,7 +202,7 @@ private: // Pointer to the handler that does the work. }; -int +int ACE_Client_Logging_Connector::fini (void) { if (this->handler_ != 0) @@ -210,13 +210,13 @@ ACE_Client_Logging_Connector::fini (void) return 0; } -int +int ACE_Client_Logging_Connector::info (char **strp, size_t length) const { char buf[BUFSIZ]; - ACE_OS::sprintf (buf, "%d/%s %s", - this->server_addr_.get_port_number (), "tcp", + ACE_OS::sprintf (buf, "%d/%s %s", + this->server_addr_.get_port_number (), "tcp", "# client logging daemon\n"); if (*strp == 0 && (*strp = ACE_OS::strdup (buf)) == 0) @@ -226,7 +226,7 @@ ACE_Client_Logging_Connector::info (char **strp, size_t length) const return ACE_OS::strlen (buf); } -int +int ACE_Client_Logging_Connector::init (int argc, char *argv[]) { ACE_LOG_MSG->open ("Client Logging Service"); @@ -235,16 +235,16 @@ ACE_Client_Logging_Connector::init (int argc, char *argv[]) // options. this->parse_args (argc, argv); - ACE_NEW_RETURN (this->handler_, + ACE_NEW_RETURN (this->handler_, ACE_Client_Logging_Handler (this->rendezvous_key_), -1); // Establish connection with the server. - if (this->connect (this->handler_, - this->server_addr_, + if (this->connect (this->handler_, + this->server_addr_, ACE_Synch_Options::synch) == -1) { - ACE_ERROR ((LM_ERROR, "%p, using stdout\n", + ACE_ERROR ((LM_ERROR, "%p, using stdout\n", "can't connect to logging server")); this->handler_ = 0; } @@ -274,7 +274,7 @@ ACE_Client_Logging_Connector::parse_args (int argc, char *argv[]) this->server_port_ = ACE_OS::atoi (get_opt.optarg); break; default: - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, "%n:\n[-p server-port]\n%a", 1), -1); } @@ -284,14 +284,14 @@ ACE_Client_Logging_Connector::parse_args (int argc, char *argv[]) return 0; } -int +int ACE_Client_Logging_Connector::suspend (void) { // To be done... return 0; } -int +int ACE_Client_Logging_Connector::resume (void) { // To be done... @@ -304,10 +304,17 @@ ACE_Client_Logging_Connector::resume (void) ACE_SVC_FACTORY_DEFINE (ACE_Client_Logging_Connector) -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Connector<ACE_Client_Logging_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Svc_Tuple<ACE_Client_Logging_Handler>; template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<ACE_Client_Logging_Handler> *>; template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<ACE_Client_Logging_Handler> *, ACE_SYNCH_RW_MUTEX>; template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<ACE_Client_Logging_Handler> *, ACE_SYNCH_RW_MUTEX>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Connector<ACE_Client_Logging_Handler, ACE_SOCK_CONNECTOR> +#pragma instantiate ACE_Svc_Tuple<ACE_Client_Logging_Handler> +#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<ACE_Client_Logging_Handler> *> +#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<ACE_Client_Logging_Handler> *, ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<ACE_Client_Logging_Handler> *, ACE_SYNCH_RW_MUTEX> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/netsvcs/lib/Name_Handler.cpp b/netsvcs/lib/Name_Handler.cpp index 0cf4deb65fe..2a18ccb9a7c 100644 --- a/netsvcs/lib/Name_Handler.cpp +++ b/netsvcs/lib/Name_Handler.cpp @@ -31,7 +31,7 @@ ACE_Name_Acceptor::parse_args (int argc, char *argv[]) this->service_port_ = ACE_OS::atoi (get_opt.optarg); break; default: - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, "%n:\n[-p server-port]\n%a", 1), -1); } @@ -53,11 +53,11 @@ ACE_Name_Acceptor::init (int argc, char *argv[]) // Set the acceptor endpoint into listen mode (use the Singleton // global Reactor...). if (this->open (this->service_addr_, ACE_Reactor::instance (), - 0, 0, 0, + 0, 0, 0, &this->scheduling_strategy_, "Name Server", "ACE naming service") == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%n: %p on port %d\n", - "acceptor::open failed", + ACE_ERROR_RETURN ((LM_ERROR, "%n: %p on port %d\n", + "acceptor::open failed", this->service_addr_.get_port_number ()), -1); // Ignore SIGPIPE so that each <SVC_HANDLER> can handle this on its @@ -70,9 +70,9 @@ ACE_Name_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_DEBUG ((LM_DEBUG, - "starting up Name Server at port %d on handle %d\n", + + ACE_DEBUG ((LM_DEBUG, + "starting up Name Server at port %d on handle %d\n", server_addr.get_port_number (), this->acceptor ().get_handle ())); return 0; @@ -94,17 +94,17 @@ ACE_Name_Handler::ACE_Name_Handler (ACE_Thread_Manager *tm) // of client requests. this->op_table_[ACE_Name_Request::BIND] = &ACE_Name_Handler::bind; this->op_table_[ACE_Name_Request::REBIND] = &ACE_Name_Handler::rebind; - this->op_table_[ACE_Name_Request::RESOLVE] = &ACE_Name_Handler::resolve; - this->op_table_[ACE_Name_Request::UNBIND] = &ACE_Name_Handler::unbind; + this->op_table_[ACE_Name_Request::RESOLVE] = &ACE_Name_Handler::resolve; + this->op_table_[ACE_Name_Request::UNBIND] = &ACE_Name_Handler::unbind; this->op_table_[ACE_Name_Request::LIST_NAMES] = &ACE_Name_Handler::lists; this->op_table_[ACE_Name_Request::LIST_NAME_ENTRIES] = &ACE_Name_Handler::lists_entries; // Assign references to simplify subsequent code. - LIST_ENTRY &list_names_ref = this->list_table_[ACE_LIST_MAP (ACE_Name_Request::LIST_NAMES, + LIST_ENTRY &list_names_ref = this->list_table_[ACE_LIST_MAP (ACE_Name_Request::LIST_NAMES, ACE_Name_Request::LIST_OP_MASK)]; - LIST_ENTRY &list_values_ref = this->list_table_[ACE_LIST_MAP (ACE_Name_Request::LIST_VALUES, + LIST_ENTRY &list_values_ref = this->list_table_[ACE_LIST_MAP (ACE_Name_Request::LIST_VALUES, ACE_Name_Request::LIST_OP_MASK)]; - LIST_ENTRY &list_types_ref = this->list_table_[ACE_LIST_MAP (ACE_Name_Request::LIST_TYPES, + LIST_ENTRY &list_types_ref = this->list_table_[ACE_LIST_MAP (ACE_Name_Request::LIST_TYPES, ACE_Name_Request::LIST_OP_MASK)]; // Set up pointers to member functions for dispatching within the @@ -126,7 +126,7 @@ ACE_Name_Handler::ACE_Name_Handler (ACE_Thread_Manager *tm) // Activate this instance of the ACE_Name_Handler (called by the // ACE_Name_Acceptor). -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Name_Handler::open (void *) { ACE_TRACE ("ACE_Name_Handler::open"); @@ -143,7 +143,7 @@ ACE_Name_Handler::open (void *) // Create and send a reply to the client. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Name_Handler::send_reply (ACE_UINT32 status, ACE_UINT32 err) { ACE_TRACE ("ACE_Name_Handler::send_reply"); @@ -156,11 +156,11 @@ ACE_Name_Handler::send_reply (ACE_UINT32 status, ACE_UINT32 err) if (len == -1) return -1; - + ssize_t n = this->peer ().send (buf, len); if (n != len) - ACE_ERROR_RETURN ((LM_ERROR, "%p\n, expected len = %d, actual len = %d", + ACE_ERROR_RETURN ((LM_ERROR, "%p\n, expected len = %d, actual len = %d", "send failed", len, n), -1); else return 0; @@ -172,12 +172,12 @@ ACE_Name_Handler::send_request (ACE_Name_Request &request) ACE_TRACE ("ACE_Name_Handler::send_request"); void *buffer; ssize_t length = request.encode (buffer); - + if (length == -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); @@ -186,7 +186,7 @@ ACE_Name_Handler::send_request (ACE_Name_Request &request) // Give up waiting (e.g., when a timeout occurs or a client shuts down // unexpectedly). - + /* VIRTUAL */ int ACE_Name_Handler::abandon (void) { @@ -196,7 +196,7 @@ ACE_Name_Handler::abandon (void) } // Enable clients to limit the amount of time they'll wait - + /* VIRTUAL */ int ACE_Name_Handler::handle_timeout (const ACE_Time_Value &, const void *) { @@ -206,7 +206,7 @@ ACE_Name_Handler::handle_timeout (const ACE_Time_Value &, const void *) // Return the underlying ACE_HANDLE. -/* VIRTUAL */ ACE_HANDLE +/* VIRTUAL */ ACE_HANDLE ACE_Name_Handler::get_handle (void) const { ACE_TRACE ("ACE_Name_Handler::get_handle"); @@ -215,7 +215,7 @@ ACE_Name_Handler::get_handle (void) const // Dispatch the appropriate operation to handle the client request. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Name_Handler::dispatch (void) { ACE_TRACE ("ACE_Name_Handler::dispatch"); @@ -230,11 +230,11 @@ ACE_Name_Handler::dispatch (void) // list_type_entries. return (this->*op_table_[ACE_TABLE_MAP (index, ACE_Name_Request::OP_TABLE_MASK)]) (); } - + // Receive, frame, and decode the client's request. Note, this method // should use non-blocking I/O. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Name_Handler::recv_request (void) { ACE_TRACE ("ACE_Name_Handler::recv_request"); @@ -249,7 +249,7 @@ ACE_Name_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", + ACE_ERROR ((LM_ERROR, "%p got %d bytes, expected %d bytes\n", "recv failed", n, sizeof (ACE_UINT32))); /* FALLTHROUGH */ case 0: @@ -271,14 +271,14 @@ ACE_Name_Handler::recv_request (void) // Receive the rest of the request message. // @@ beware of blocking read!!!. - n = this->peer ().recv ((void *) (((char *) &this->name_request_) - + sizeof (ACE_UINT32)), + n = this->peer ().recv ((void *) (((char *) &this->name_request_) + + sizeof (ACE_UINT32)), length - sizeof (ACE_UINT32)); // Subtract off the size of the part we skipped over... if (n != (length - (ssize_t) sizeof (ACE_UINT32))) { - ACE_ERROR ((LM_ERROR, "%p expected %d, got %d\n", + ACE_ERROR ((LM_ERROR, "%p expected %d, got %d\n", "invalid length", length, n)); return this->abandon (); } @@ -297,7 +297,7 @@ ACE_Name_Handler::recv_request (void) // Callback method invoked by the ACE_Reactor when events arrive from // the client. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Name_Handler::handle_input (ACE_HANDLE) { ACE_TRACE ("ACE_Name_Handler::handle_input"); @@ -335,13 +335,13 @@ ACE_Name_Handler::shared_bind (int rebind) if (rebind == 0) { ACE_DEBUG ((LM_DEBUG, "request for BIND \n")); - result = this->naming_context_->bind (a_name, a_value, + result = this->naming_context_->bind (a_name, a_value, this->name_request_.type ()); } else { ACE_DEBUG ((LM_DEBUG, "request for REBIND \n")); - result = this->naming_context_->rebind (a_name, a_value, + result = this->naming_context_->rebind (a_name, a_value, this->name_request_.type ()); if (result == 1) result = 0; @@ -363,7 +363,7 @@ ACE_Name_Handler::resolve (void) // pre-suppose success (indicated by type RESOLVE). ACE_WString avalue; - char *atype; + char *atype; if (this->naming_context_->resolve (a_name, avalue, atype) == 0) { ACE_Name_Request nrq (ACE_Name_Request::RESOLVE, @@ -373,8 +373,8 @@ ACE_Name_Handler::resolve (void) atype, ACE_OS::strlen (atype)); return this->send_request (nrq); } - - ACE_Name_Request nrq (ACE_Name_Request::BIND, NULL, 0, NULL, 0, NULL, 0); + + ACE_Name_Request nrq (ACE_Name_Request::BIND, NULL, 0, NULL, 0, NULL, 0); this->send_request (nrq); return 0; } @@ -391,7 +391,7 @@ ACE_Name_Handler::unbind (void) else return this->send_reply (ACE_Name_Reply::FAILURE); } -ACE_Name_Request +ACE_Name_Request ACE_Name_Handler::name_request (ACE_WString *one_name) { ACE_TRACE ("ACE_Name_Handler::name_request"); @@ -429,12 +429,12 @@ ACE_Name_Handler::lists (void) { ACE_TRACE ("ACE_Name_Handler::lists"); - ACE_PWSTRING_SET set; + ACE_PWSTRING_SET set; ACE_WString pattern (this->name_request_.name (), this->name_request_.name_len () / sizeof (ACE_USHORT16)); // Get the index into the list table - int index = ACE_LIST_MAP (this->name_request_.msg_type (), + int index = ACE_LIST_MAP (this->name_request_.msg_type (), ACE_Name_Request::LIST_OP_MASK); // Print the message type @@ -452,7 +452,7 @@ ACE_Name_Handler::lists (void) else { ACE_WString *one_entry = 0; - + for (ACE_Unbounded_Set_Iterator<ACE_WString> set_iterator (set); set_iterator.next (one_entry) !=0; set_iterator.advance()) @@ -479,12 +479,12 @@ int ACE_Name_Handler::lists_entries (void) { ACE_TRACE ("ACE_Name_Handler::lists_entries"); - ACE_BINDING_SET set; + ACE_BINDING_SET set; ACE_WString pattern (this->name_request_.name (), this->name_request_.name_len () / sizeof (ACE_USHORT16)); int (ACE_Naming_Context::*ptmf) (ACE_BINDING_SET &, const ACE_WString &); - + switch (this->name_request_.msg_type ()) { case ACE_Name_Request::LIST_NAME_ENTRIES: @@ -500,9 +500,9 @@ ACE_Name_Handler::lists_entries (void) ptmf = &ACE_Naming_Context::list_type_entries; break; default: - return -1; + return -1; } - + if ((this->naming_context_->*ptmf) (set, pattern) != 0) { // None found so send blank request back. @@ -514,7 +514,7 @@ ACE_Name_Handler::lists_entries (void) else { ACE_Name_Binding *one_entry = 0; - + for (ACE_Unbounded_Set_Iterator<ACE_Name_Binding> set_iterator (set); set_iterator.next (one_entry) !=0; set_iterator.advance()) @@ -530,9 +530,9 @@ ACE_Name_Handler::lists_entries (void) if (this->send_request (mynrq) == -1) return -1; } - + // send last message indicator - ACE_Name_Request nrq (ACE_Name_Request::MAX_ENUM, NULL, 0, NULL, 0, NULL, 0); + ACE_Name_Request nrq (ACE_Name_Request::MAX_ENUM, NULL, 0, NULL, 0, NULL, 0); if (this->send_request (nrq) == -1) return -1; @@ -550,7 +550,7 @@ ACE_Name_Handler::~ACE_Name_Handler (void) delete this->naming_context_; } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Accept_Strategy<ACE_Name_Handler, ACE_SOCK_ACCEPTOR>; template class ACE_Acceptor<ACE_Name_Handler, ACE_SOCK_ACCEPTOR>; template class ACE_Concurrency_Strategy<ACE_Name_Handler>; @@ -558,4 +558,13 @@ template class ACE_Creation_Strategy<ACE_Name_Handler>; template class ACE_Schedule_All_Reactive_Strategy<ACE_Name_Handler>; template class ACE_Scheduling_Strategy<ACE_Name_Handler>; template class ACE_Strategy_Acceptor<ACE_Name_Handler, ACE_SOCK_ACCEPTOR>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Accept_Strategy<ACE_Name_Handler, ACE_SOCK_ACCEPTOR> +#pragma instantiate ACE_Acceptor<ACE_Name_Handler, ACE_SOCK_ACCEPTOR> +#pragma instantiate ACE_Concurrency_Strategy<ACE_Name_Handler> +#pragma instantiate ACE_Creation_Strategy<ACE_Name_Handler> +#pragma instantiate ACE_Schedule_All_Reactive_Strategy<ACE_Name_Handler> +#pragma instantiate ACE_Scheduling_Strategy<ACE_Name_Handler> +#pragma instantiate ACE_Strategy_Acceptor<ACE_Name_Handler, ACE_SOCK_ACCEPTOR> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/netsvcs/lib/Server_Logging_Handler.cpp b/netsvcs/lib/Server_Logging_Handler.cpp index e9cc86f1255..a40ac0bdc2d 100644 --- a/netsvcs/lib/Server_Logging_Handler.cpp +++ b/netsvcs/lib/Server_Logging_Handler.cpp @@ -15,7 +15,7 @@ ACE_SVC_FACTORY_DEFINE (ACE_Server_Logging_Acceptor) ACE_SVC_FACTORY_DEFINE (ACE_Thr_Server_Logging_Acceptor) -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class Log_Message_Receiver_Impl<ACE_NULL_SYNCH>; template class Static_Log_Message_Receiver<ACE_NULL_SYNCH>; template class ACE_Acceptor<Null_Synch_Logging_Handler_Static_Receiver, LOGGING_PEER_ACCEPTOR>; @@ -25,8 +25,8 @@ template class ACE_Creation_Strategy<Null_Synch_Logging_Handler_Static_Receiver> template class ACE_Schedule_All_Reactive_Strategy<Null_Synch_Logging_Handler_Static_Receiver>; template class ACE_Scheduling_Strategy<Null_Synch_Logging_Handler_Static_Receiver>; template class ACE_Strategy_Acceptor<Null_Synch_Logging_Handler_Static_Receiver, LOGGING_PEER_ACCEPTOR>; -template class ACE_Server_Logging_Acceptor_T<Null_Synch_Logging_Handler_Static_Receiver, - Null_Synch_Static_Receiver, +template class ACE_Server_Logging_Acceptor_T<Null_Synch_Logging_Handler_Static_Receiver, + Null_Synch_Static_Receiver, ACE_Schedule_All_Reactive_Strategy<Null_Synch_Logging_Handler_Static_Receiver> >; template class ACE_Server_Logging_Handler_T<LOGGING_PEER_STREAM, u_long, ACE_NULL_SYNCH, Null_Synch_Static_Receiver>; template class ACE_Server_Logging_Handler<Null_Synch_Static_Receiver>; @@ -70,23 +70,23 @@ template class ACE_Strategy_Acceptor<Synch_Thr_Logging_Handler_Static_Receiver, template class ACE_Strategy_Acceptor<Synch_Logging_Handler_Receiver, LOGGING_PEER_ACCEPTOR>; template class ACE_Strategy_Acceptor<Synch_Thr_Logging_Handler_Receiver, LOGGING_PEER_ACCEPTOR>; -template class ACE_Server_Logging_Acceptor_T<Synch_Logging_Handler_Static_Receiver, - Synch_Static_Receiver, +template class ACE_Server_Logging_Acceptor_T<Synch_Logging_Handler_Static_Receiver, + Synch_Static_Receiver, ACE_Schedule_All_Reactive_Strategy<Synch_Logging_Handler_Static_Receiver> >; -template class ACE_Server_Logging_Acceptor_T<Synch_Thr_Logging_Handler_Static_Receiver, - Synch_Static_Receiver, +template class ACE_Server_Logging_Acceptor_T<Synch_Thr_Logging_Handler_Static_Receiver, + Synch_Static_Receiver, ACE_Schedule_All_Threaded_Strategy<Synch_Thr_Logging_Handler_Static_Receiver> >; -template class ACE_Server_Logging_Acceptor_T<Synch_Logging_Handler_Receiver, - Synch_Receiver, +template class ACE_Server_Logging_Acceptor_T<Synch_Logging_Handler_Receiver, + Synch_Receiver, ACE_Schedule_All_Reactive_Strategy<Synch_Logging_Handler_Receiver> >; -template class ACE_Server_Logging_Acceptor_T<Synch_Thr_Logging_Handler_Receiver, - Synch_Receiver, +template class ACE_Server_Logging_Acceptor_T<Synch_Thr_Logging_Handler_Receiver, + Synch_Receiver, ACE_Schedule_All_Threaded_Strategy<Synch_Thr_Logging_Handler_Receiver> >; template class ACE_Server_Logging_Handler_T<LOGGING_PEER_STREAM, u_long, ACE_NULL_SYNCH, Synch_Static_Receiver>; template class ACE_Server_Logging_Handler_T<LOGGING_PEER_STREAM, u_long, ACE_NULL_SYNCH, Synch_Receiver>; - #if defined (ACE_HAS_THREADS) + #if defined (ACE_HAS_THREADS) template class ACE_Server_Logging_Handler_T<LOGGING_PEER_STREAM, ACE_LOGGER_COUNTER, ACE_MT_SYNCH, Synch_Static_Receiver>; template class ACE_Server_Logging_Handler_T<LOGGING_PEER_STREAM, ACE_LOGGER_COUNTER, ACE_MT_SYNCH, Synch_Receiver>; template class Log_Message_Receiver_Impl<ACE_MT_SYNCH>; @@ -98,7 +98,7 @@ template class ACE_Server_Logging_Handler<Synch_Receiver>; template class ACE_Thr_Server_Logging_Handler<Synch_Receiver>; template class ACE_Svc_Handler<LOGGING_PEER_STREAM, ACE_SYNCH>; - + #if defined (ACE_HAS_TLI) #if defined (ACE_HAS_THREADS) template class ACE_Svc_Handler<LOGGING_PEER_STREAM, ACE_NULL_SYNCH>; @@ -109,7 +109,102 @@ template class ACE_Svc_Handler<LOGGING_PEER_STREAM, ACE_SYNCH>; // That specialization is in TS_Server_Handler.cpp, so we don't need it // here. #endif /* ACE_HAS_TLI */ -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate Log_Message_Receiver_Impl<ACE_NULL_SYNCH> +#pragma instantiate Static_Log_Message_Receiver<ACE_NULL_SYNCH> +#pragma instantiate ACE_Acceptor<Null_Synch_Logging_Handler_Static_Receiver, LOGGING_PEER_ACCEPTOR> +#pragma instantiate ACE_Accept_Strategy<Null_Synch_Logging_Handler_Static_Receiver, LOGGING_PEER_ACCEPTOR> +#pragma instantiate ACE_Concurrency_Strategy<Null_Synch_Logging_Handler_Static_Receiver> +#pragma instantiate ACE_Creation_Strategy<Null_Synch_Logging_Handler_Static_Receiver> +#pragma instantiate ACE_Schedule_All_Reactive_Strategy<Null_Synch_Logging_Handler_Static_Receiver> +#pragma instantiate ACE_Scheduling_Strategy<Null_Synch_Logging_Handler_Static_Receiver> +#pragma instantiate ACE_Strategy_Acceptor<Null_Synch_Logging_Handler_Static_Receiver, LOGGING_PEER_ACCEPTOR> +#pragma instantiate ACE_Server_Logging_Acceptor_T<Null_Synch_Logging_Handler_Static_Receiver, \ + Null_Synch_Static_Receiver, \ + ACE_Schedule_All_Reactive_Strategy<Null_Synch_Logging_Handler_Static_Receiver> > +#pragma instantiate ACE_Server_Logging_Handler_T<LOGGING_PEER_STREAM, u_long, ACE_NULL_SYNCH, Null_Synch_Static_Receiver> +#pragma instantiate ACE_Server_Logging_Handler<Null_Synch_Static_Receiver> + + +#pragma instantiate Static_Log_Message_Receiver<ACE_LOGGER_SYNCH> +#pragma instantiate Log_Message_Receiver<ACE_LOGGER_SYNCH> +#pragma instantiate ACE_Acceptor<Synch_Logging_Handler_Static_Receiver, LOGGING_PEER_ACCEPTOR> +#pragma instantiate ACE_Acceptor<Synch_Thr_Logging_Handler_Static_Receiver, LOGGING_PEER_ACCEPTOR> +#pragma instantiate ACE_Acceptor<Synch_Logging_Handler_Receiver, LOGGING_PEER_ACCEPTOR> +#pragma instantiate ACE_Acceptor<Synch_Thr_Logging_Handler_Receiver, LOGGING_PEER_ACCEPTOR> + +#pragma instantiate ACE_Accept_Strategy<Synch_Logging_Handler_Static_Receiver, LOGGING_PEER_ACCEPTOR> +#pragma instantiate ACE_Accept_Strategy<Synch_Thr_Logging_Handler_Static_Receiver, LOGGING_PEER_ACCEPTOR> +#pragma instantiate ACE_Accept_Strategy<Synch_Logging_Handler_Receiver, LOGGING_PEER_ACCEPTOR> +#pragma instantiate ACE_Accept_Strategy<Synch_Thr_Logging_Handler_Receiver, LOGGING_PEER_ACCEPTOR> + +#pragma instantiate ACE_Concurrency_Strategy<Synch_Logging_Handler_Static_Receiver> +#pragma instantiate ACE_Concurrency_Strategy<Synch_Thr_Logging_Handler_Static_Receiver> +#pragma instantiate ACE_Concurrency_Strategy<Synch_Logging_Handler_Receiver> +#pragma instantiate ACE_Concurrency_Strategy<Synch_Thr_Logging_Handler_Receiver> + +#pragma instantiate ACE_Creation_Strategy<Synch_Logging_Handler_Static_Receiver> +#pragma instantiate ACE_Creation_Strategy<Synch_Thr_Logging_Handler_Static_Receiver> +#pragma instantiate ACE_Creation_Strategy<Synch_Logging_Handler_Receiver> +#pragma instantiate ACE_Creation_Strategy<Synch_Thr_Logging_Handler_Receiver> + +#pragma instantiate ACE_Schedule_All_Reactive_Strategy<Synch_Logging_Handler_Static_Receiver> +#pragma instantiate ACE_Schedule_All_Reactive_Strategy<Synch_Logging_Handler_Receiver> + +#pragma instantiate ACE_Schedule_All_Threaded_Strategy<Synch_Thr_Logging_Handler_Static_Receiver> +#pragma instantiate ACE_Schedule_All_Threaded_Strategy<Synch_Thr_Logging_Handler_Receiver> + +#pragma instantiate ACE_Scheduling_Strategy<Synch_Logging_Handler_Static_Receiver> +#pragma instantiate ACE_Scheduling_Strategy<Synch_Logging_Handler_Receiver> +#pragma instantiate ACE_Scheduling_Strategy<Synch_Thr_Logging_Handler_Static_Receiver> +#pragma instantiate ACE_Scheduling_Strategy<Synch_Thr_Logging_Handler_Receiver> + +#pragma instantiate ACE_Strategy_Acceptor<Synch_Logging_Handler_Static_Receiver, LOGGING_PEER_ACCEPTOR> +#pragma instantiate ACE_Strategy_Acceptor<Synch_Thr_Logging_Handler_Static_Receiver, LOGGING_PEER_ACCEPTOR> +#pragma instantiate ACE_Strategy_Acceptor<Synch_Logging_Handler_Receiver, LOGGING_PEER_ACCEPTOR> +#pragma instantiate ACE_Strategy_Acceptor<Synch_Thr_Logging_Handler_Receiver, LOGGING_PEER_ACCEPTOR> + +#pragma instantiate ACE_Server_Logging_Acceptor_T<Synch_Logging_Handler_Static_Receiver, \ + Synch_Static_Receiver, \ + ACE_Schedule_All_Reactive_Strategy<Synch_Logging_Handler_Static_Receiver> > +#pragma instantiate ACE_Server_Logging_Acceptor_T<Synch_Thr_Logging_Handler_Static_Receiver, \ + Synch_Static_Receiver, \ + ACE_Schedule_All_Threaded_Strategy<Synch_Thr_Logging_Handler_Static_Receiver> > +#pragma instantiate ACE_Server_Logging_Acceptor_T<Synch_Logging_Handler_Receiver, \ + Synch_Receiver, \ + ACE_Schedule_All_Reactive_Strategy<Synch_Logging_Handler_Receiver> > +#pragma instantiate ACE_Server_Logging_Acceptor_T<Synch_Thr_Logging_Handler_Receiver, \ + Synch_Receiver, \ + ACE_Schedule_All_Threaded_Strategy<Synch_Thr_Logging_Handler_Receiver> > + +#pragma instantiate ACE_Server_Logging_Handler_T<LOGGING_PEER_STREAM, u_long, ACE_NULL_SYNCH, Synch_Static_Receiver> +#pragma instantiate ACE_Server_Logging_Handler_T<LOGGING_PEER_STREAM, u_long, ACE_NULL_SYNCH, Synch_Receiver> + + #if defined (ACE_HAS_THREADS) + #pragma instantiate ACE_Server_Logging_Handler_T<LOGGING_PEER_STREAM, ACE_LOGGER_COUNTER, ACE_MT_SYNCH, Synch_Static_Receiver> + #pragma instantiate ACE_Server_Logging_Handler_T<LOGGING_PEER_STREAM, ACE_LOGGER_COUNTER, ACE_MT_SYNCH, Synch_Receiver> + #pragma instantiate Log_Message_Receiver_Impl<ACE_MT_SYNCH> + #endif /* ACE_HAS_THREADS */ + +#pragma instantiate ACE_Server_Logging_Handler<Synch_Static_Receiver> +#pragma instantiate ACE_Thr_Server_Logging_Handler<Synch_Static_Receiver> +#pragma instantiate ACE_Server_Logging_Handler<Synch_Receiver> +#pragma instantiate ACE_Thr_Server_Logging_Handler<Synch_Receiver> + +#pragma instantiate ACE_Svc_Handler<LOGGING_PEER_STREAM, ACE_SYNCH> + + #if defined (ACE_HAS_TLI) + #if defined (ACE_HAS_THREADS) + #pragma instantiate ACE_Svc_Handler<LOGGING_PEER_STREAM, ACE_NULL_SYNCH> + #endif /* ACE_HAS_THREADS */ + // else if ! ACE_HAS_TLI, LOGGING_PEER_STREAM is ACE_SOCK_STREAM, + // and the specialization would be + // #pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> + // That specialization is in TS_Server_Handler.cpp, so we don't need it + // here. + #endif /* ACE_HAS_TLI */ +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + #endif /* ACE_SERVER_LOGGING_HANDLERT_C */ diff --git a/netsvcs/lib/TS_Clerk_Handler.cpp b/netsvcs/lib/TS_Clerk_Handler.cpp index 272c30811ac..8c248f0c7b6 100644 --- a/netsvcs/lib/TS_Clerk_Handler.cpp +++ b/netsvcs/lib/TS_Clerk_Handler.cpp @@ -55,7 +55,7 @@ ACE_TS_Clerk_Handler::timeout (void) ACE_TRACE ("ACE_TS_Clerk_Handler::timeout"); int old_timeout = this->timeout_; this->timeout_ *= 2; - + if (this->timeout_ > this->max_timeout_) this->timeout_ = this->max_timeout_; @@ -87,7 +87,7 @@ ACE_TS_Clerk_Handler::max_timeout (void) return this->max_timeout_; } -int +int ACE_TS_Clerk_Handler::open (void *) { ACE_TRACE ("ACE_TS_Clerk_Handler::open"); @@ -100,22 +100,22 @@ ACE_TS_Clerk_Handler::open (void *) // reconnections. #if !defined (ACE_WIN32) if (ACE_Reactor::instance ()->register_handler (SIGPIPE, this) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%n: %p\n", + ACE_ERROR_RETURN ((LM_ERROR, "%n: %p\n", "register_handler (SIGPIPE)"), -1); #endif // Register ourselves with the reactor to receive input - if (ACE_Reactor::instance ()->register_handler (this->get_handle (), + if (ACE_Reactor::instance ()->register_handler (this->get_handle (), this, - ACE_Event_Handler::READ_MASK | + ACE_Event_Handler::READ_MASK | ACE_Event_Handler::EXCEPT_MASK) == -1) ACE_ERROR ((LM_ERROR, "%n: %p\n", "register_handler (this)")); // Figure out what remote port we're really bound to. else if (this->peer ().get_remote_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "get_remote_addr"), -1); - - ACE_DEBUG ((LM_DEBUG, + + ACE_DEBUG ((LM_DEBUG, "TS Clerk Daemon connected to port %d on handle %d\n", server_addr.get_port_number (), this->peer ().get_handle ())); @@ -123,14 +123,14 @@ ACE_TS_Clerk_Handler::open (void *) return 0; } -ACE_HANDLE +ACE_HANDLE ACE_TS_Clerk_Handler::get_handle (void) const { ACE_TRACE ("ACE_TS_Clerk_Handler::get_handle"); return this->peer().get_handle (); } -int +int ACE_TS_Clerk_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask mask) { @@ -149,14 +149,14 @@ ACE_TS_Clerk_Handler::reinitiate_connection (void) // Skip over deactivated descriptors. // Set state to connecting so that we don't try to send anything - // using this handler + // using this handler this->state (ACE_TS_Clerk_Handler::CONNECTING); if (this->get_handle () != ACE_INVALID_HANDLE) { ACE_DEBUG ((LM_DEBUG, "(%t) Scheduling reinitiation of connection\n")); // Reschedule ourselves to try and connect again. - if (ACE_Reactor::instance ()->schedule_timer (this, 0, + if (ACE_Reactor::instance ()->schedule_timer (this, 0, this->timeout ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "schedule_timer"), -1); } @@ -198,12 +198,12 @@ ACE_TS_Clerk_Handler::handle_timeout (const ACE_Time_Value &, const void *) { ACE_TRACE ("ACE_TS_Clerk_Handler::handle_timeout"); - ACE_DEBUG ((LM_DEBUG, - "(%t) attempting to reconnect to server with timeout = %d\n", + ACE_DEBUG ((LM_DEBUG, + "(%t) attempting to reconnect to server with timeout = %d\n", this->timeout_)); // Close down peer to reclaim descriptor if need be. Note this is - // necessary to reconnect. + // necessary to reconnect. this->peer ().close (); return this->processor_->initiate_connection (this, ACE_Synch_Options::asynch); @@ -238,12 +238,12 @@ ACE_TS_Clerk_Handler::recv_reply (ACE_Time_Request &reply) switch (n) { case -1: - // FALLTHROUGH + // FALLTHROUGH ACE_DEBUG ((LM_DEBUG, "****************** recv_reply returned -1\n")); default: ACE_ERROR ((LM_ERROR, "%p got %d bytes, expected %d bytes\n", "recv failed", n, bytes_expected)); - // FALLTHROUGH + // FALLTHROUGH case 0: // We've shutdown unexpectedly return -1; @@ -252,7 +252,7 @@ ACE_TS_Clerk_Handler::recv_reply (ACE_Time_Request &reply) } else if (reply.decode () == -1) // Decode the request into host byte order. ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "decode failed"), -1); - return 0; + return 0; } @@ -265,17 +265,17 @@ ACE_TS_Clerk_Handler::send_request (ACE_UINT32 sequence_num, ACE_Time_Info &time // Update current sequence number this->cur_sequence_num_ = sequence_num; - + // First update the current time info. time_info.delta_time_ = this->time_info_.delta_time_; time_info.sequence_num_ = this->time_info_.sequence_num_; // Now prepare a new time update request ACE_Time_Request request (ACE_Time_Request::TIME_UPDATE, 0, 0); - + if ((length = request.encode (buffer)) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "encode failed"), -1); - + // Compute start time of sending request (needed to compute // roundtrip delay) this->start_time_ = ACE_OS::time (0); @@ -284,7 +284,7 @@ ACE_TS_Clerk_Handler::send_request (ACE_UINT32 sequence_num, ACE_Time_Info &time if (this->peer ().send_n (buffer, length) != length) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "send_n failed"), -1); - return 0; + return 0; } ACE_TS_Clerk_Processor::ACE_TS_Clerk_Processor () @@ -306,7 +306,7 @@ ACE_TS_Clerk_Processor::alloc (void) { // Allocate the space out of shared memory for the system time entry void *temp = this->shmem_->malloc (sizeof (this->system_time_)); - + // Give it a name binding this->shmem_->bind (ACE_DEFAULT_TIME_SERVER_STR, temp); @@ -330,7 +330,7 @@ ACE_TS_Clerk_Processor::handle_timeout (const ACE_Time_Value &, return this->update_time (); } -int +int ACE_TS_Clerk_Processor::update_time () { ACE_TRACE ("ACE_TS_Clerk_Processor::update_time"); @@ -345,11 +345,11 @@ ACE_TS_Clerk_Processor::update_time () // Call send_request() on all handlers ACE_TS_Clerk_Handler **handler = 0; - + for (HANDLER_SET_ITERATOR set_iterator (this->handler_set_); set_iterator.next (handler) != 0; set_iterator.advance ()) - { + { if ((*handler)->state () == ACE_TS_Clerk_Handler::ESTABLISHED) { if ((*handler)->send_request (this->cur_sequence_num_, time_info) == -1) @@ -370,8 +370,8 @@ ACE_TS_Clerk_Processor::update_time () // Note that we are keeping two things in shared memory: the delta // time (difference between our system clock and the local clock), // and the last local time - if (count > 0) - { + if (count > 0) + { // At least one server is out there *(this->system_time_.delta_time_) = total_delta/count; } @@ -390,7 +390,7 @@ ACE_TS_Clerk_Processor::update_time () } -int +int ACE_TS_Clerk_Processor::fini (void) { ACE_TRACE ("ACE_TS_Clerk_Processor::fini"); @@ -405,7 +405,7 @@ ACE_TS_Clerk_Processor::fini (void) for (HANDLER_SET_ITERATOR set_iterator (this->handler_set_); set_iterator.next (handler) != 0; set_iterator.advance ()) - { + { if ((*handler)->state () != ACE_TS_Clerk_Handler::IDLE) // Mark state as DISCONNECTING so we don't try to reconnect... (*handler)->state (ACE_TS_Clerk_Handler::DISCONNECTING); @@ -418,18 +418,18 @@ ACE_TS_Clerk_Processor::fini (void) this->shmem_->remove (); ACE_Connector <ACE_TS_Clerk_Handler, ACE_SOCK_CONNECTOR>::fini (); - + return 0; } -int +int ACE_TS_Clerk_Processor::info (char **, size_t) const { ACE_TRACE ("ACE_TS_Clerk_Processor::info"); return 0; } -int +int ACE_TS_Clerk_Processor::init (int argc, char *argv[]) { ACE_TRACE ("ACE_TS_Clerk_Processor::init"); @@ -445,22 +445,22 @@ ACE_TS_Clerk_Processor::init (int argc, char *argv[]) ACE_UNUSED_ARG (sig); #endif /* ACE_WIN32 */ - ACE_Synch_Options &synch_options = this->blocking_semantics_ == 0 + ACE_Synch_Options &synch_options = this->blocking_semantics_ == 0 ? ACE_Synch_Options::asynch : ACE_Synch_Options::synch; // Now set up connections to all servers ACE_TS_Clerk_Handler **handler = 0; - + for (HANDLER_SET_ITERATOR set_iterator (this->handler_set_); set_iterator.next (handler) != 0; set_iterator.advance ()) - { + { this->initiate_connection (*handler, synch_options); } // Now set up timer to receive updates from server // set the timer to go off after timeout value - this->timer_id_ = ACE_Reactor::instance ()->schedule_timer (this, - NULL, + this->timer_id_ = ACE_Reactor::instance ()->schedule_timer (this, + NULL, ACE_Time_Value (this->timeout_), ACE_Time_Value (this->timeout_)); return 0; @@ -478,7 +478,7 @@ ACE_TS_Clerk_Processor::initiate_connection (ACE_TS_Clerk_Handler *handler, handler->state (ACE_TS_Clerk_Handler::IDLE); if (handler->remote_addr ().addr_to_string (buf, sizeof buf) == -1) - ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", + ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "can't obtain peer's address"), -1); // Establish connection with the server. @@ -494,12 +494,12 @@ ACE_TS_Clerk_Processor::initiate_connection (ACE_TS_Clerk_Handler *handler, // Reschedule ourselves to try and connect again. if (synch_options[ACE_Synch_Options::USE_REACTOR]) { - if (ACE_Reactor::instance ()->schedule_timer (handler, - 0, + if (ACE_Reactor::instance ()->schedule_timer (handler, + 0, handler->timeout ()) == -1) ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "schedule_timer"), -1); } - else + else // Failures on synchronous connects are reported as errors // so that the caller can decide how to proceed. return -1; @@ -507,16 +507,16 @@ ACE_TS_Clerk_Processor::initiate_connection (ACE_TS_Clerk_Handler *handler, else { handler->state (ACE_TS_Clerk_Handler::CONNECTING); - ACE_DEBUG ((LM_DEBUG, + ACE_DEBUG ((LM_DEBUG, "(%t) in the process of connecting %s to %s\n", - synch_options[ACE_Synch_Options::USE_REACTOR] + synch_options[ACE_Synch_Options::USE_REACTOR] ? "asynchronously" : "synchronously", buf)); } } - else + else { handler->state (ACE_TS_Clerk_Handler::ESTABLISHED); - ACE_DEBUG ((LM_DEBUG, "(%t) connected to %s on %d\n", + ACE_DEBUG ((LM_DEBUG, "(%t) connected to %s on %d\n", buf, handler->get_handle ())); } return 0; @@ -532,7 +532,7 @@ ACE_TS_Clerk_Processor::parse_args (int argc, char *argv[]) // Create a default entry ACE_OS::sprintf (server_host, "%s:%d", - ACE_DEFAULT_SERVER_HOST, + ACE_DEFAULT_SERVER_HOST, ACE_DEFAULT_LOGGING_SERVER_PORT); ACE_Get_Opt get_opt (argc, argv, "h:t:p:b", 0); @@ -549,7 +549,7 @@ ACE_TS_Clerk_Processor::parse_args (int argc, char *argv[]) ACE_NEW_RETURN (handler, ACE_TS_Clerk_Handler (this, server_addr), -1); - + // Cache the handler this->handler_set_.insert (handler); break; @@ -568,7 +568,7 @@ ACE_TS_Clerk_Processor::parse_args (int argc, char *argv[]) this->blocking_semantics_ = 1; break; default: - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, "%n:\n[-h hostname:port] [-t timeout] [-p poolname]\n%a", 1), -1); } @@ -576,14 +576,14 @@ ACE_TS_Clerk_Processor::parse_args (int argc, char *argv[]) return 0; } -int +int ACE_TS_Clerk_Processor::suspend (void) { ACE_TRACE ("ACE_TS_Clerk_Processor::suspend"); return 0; } -int +int ACE_TS_Clerk_Processor::resume (void) { ACE_TRACE ("ACE_TS_Clerk_Processor::resume"); @@ -595,7 +595,7 @@ ACE_TS_Clerk_Processor::resume (void) ACE_SVC_FACTORY_DEFINE (ACE_TS_Clerk_Processor) -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Connector<ACE_TS_Clerk_Handler, ACE_SOCK_CONNECTOR>; template class ACE_Node<ACE_TS_Clerk_Handler *>; template class ACE_Svc_Tuple<ACE_TS_Clerk_Handler>; @@ -604,4 +604,14 @@ template class ACE_Unbounded_Set_Iterator<ACE_TS_Clerk_Handler *>; template class ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *>; template class ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX>; template class ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Connector<ACE_TS_Clerk_Handler, ACE_SOCK_CONNECTOR> +#pragma instantiate ACE_Node<ACE_TS_Clerk_Handler *> +#pragma instantiate ACE_Svc_Tuple<ACE_TS_Clerk_Handler> +#pragma instantiate ACE_Unbounded_Set<ACE_TS_Clerk_Handler *> +#pragma instantiate ACE_Unbounded_Set_Iterator<ACE_TS_Clerk_Handler *> +#pragma instantiate ACE_Map_Entry<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *> +#pragma instantiate ACE_Map_Iterator<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX> +#pragma instantiate ACE_Map_Manager<ACE_HANDLE, ACE_Svc_Tuple<ACE_TS_Clerk_Handler> *, ACE_SYNCH_RW_MUTEX> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/netsvcs/lib/TS_Server_Handler.cpp b/netsvcs/lib/TS_Server_Handler.cpp index 95736e085c7..ad35c939665 100644 --- a/netsvcs/lib/TS_Server_Handler.cpp +++ b/netsvcs/lib/TS_Server_Handler.cpp @@ -26,7 +26,7 @@ ACE_TS_Server_Acceptor::parse_args (int argc, char *argv[]) this->service_port_ = ACE_OS::atoi (get_opt.optarg); break; default: - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, "%n:\n[-p server-port]\n%a", 1), -1); } @@ -47,11 +47,11 @@ ACE_TS_Server_Acceptor::init (int argc, char *argv[]) // Set the acceptor endpoint into listen mode (use the Singleton // global Reactor...). if (this->open (this->service_addr_, ACE_Reactor::instance (), - 0, 0, 0, + 0, 0, 0, &this->scheduling_strategy_, "Time Server", "ACE time service") == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%n: %p on port %d\n", - "acceptor::open failed", + ACE_ERROR_RETURN ((LM_ERROR, "%n: %p on port %d\n", + "acceptor::open failed", this->service_addr_.get_port_number ()), -1); // Ignore SIGPIPE so that each <SVC_HANDLER> can handle this on its @@ -64,9 +64,9 @@ 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_DEBUG ((LM_DEBUG, - "starting up Time Server at port %d on handle %d\n", + + ACE_DEBUG ((LM_DEBUG, + "starting up Time Server at port %d on handle %d\n", server_addr.get_port_number (), this->acceptor ().get_handle ())); return 0; @@ -87,7 +87,7 @@ ACE_TS_Server_Handler::ACE_TS_Server_Handler (ACE_Thread_Manager *tm) // Activate this instance of the ACE_TS_Server_Handler (called by the // ACE_TS_Server_Acceptor). -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_TS_Server_Handler::open (void *) { ACE_TRACE ("ACE_TS_Server_Handler::open"); @@ -113,12 +113,12 @@ ACE_TS_Server_Handler::send_request (ACE_Time_Request &request) ACE_TRACE ("ACE_TS_Server_Handler::send_request"); void *buffer; ssize_t length = request.encode (buffer); - + if (length == -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); @@ -127,14 +127,14 @@ ACE_TS_Server_Handler::send_request (ACE_Time_Request &request) // Give up waiting (e.g., when a timeout occurs or a client shuts down // unexpectedly). - + /* VIRTUAL */ int ACE_TS_Server_Handler::abandon (void) { ACE_TRACE ("ACE_TS_Server_Handler::abandon"); // Note we are using the time field to report the errno in case of - // failure. + // failure. ACE_Time_Request rq (ACE_Time_Request::FAILURE, errno); return this->send_request (rq); } @@ -149,7 +149,7 @@ ACE_TS_Server_Handler::handle_timeout (const ACE_Time_Value &, const void *) // Return the underlying ACE_HANDLE. -/* VIRTUAL */ ACE_HANDLE +/* VIRTUAL */ ACE_HANDLE ACE_TS_Server_Handler::get_handle (void) const { ACE_TRACE ("ACE_TS_Server_Handler::get_handle"); @@ -158,7 +158,7 @@ ACE_TS_Server_Handler::get_handle (void) const // Dispatch the appropriate operation to handle the client request. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_TS_Server_Handler::dispatch (void) { ACE_TRACE ("ACE_TS_Server_Handler::dispatch"); @@ -167,11 +167,11 @@ ACE_TS_Server_Handler::dispatch (void) ACE_Time_Request rq (ACE_Time_Request::TIME_UPDATE, t); return this->send_request (rq); } - + // Receive, frame, and decode the client's request. Note, this method // should use non-blocking I/O. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_TS_Server_Handler::recv_request (void) { ACE_TRACE ("ACE_TS_Server_Handler::recv_request"); @@ -188,7 +188,7 @@ 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", + ACE_ERROR ((LM_ERROR, "%p got %d bytes, expected %d bytes\n", "recv failed", n, bytes_expected)); /* FALLTHROUGH */ case 0: @@ -213,7 +213,7 @@ ACE_TS_Server_Handler::recv_request (void) // Callback method invoked by the ACE_Reactor when events arrive from // the client. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_TS_Server_Handler::handle_input (ACE_HANDLE) { ACE_TRACE ("ACE_TS_Server_Handler::handle_input"); @@ -231,7 +231,7 @@ ACE_TS_Server_Handler::~ACE_TS_Server_Handler (void) this->get_handle ())); } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Accept_Strategy<ACE_TS_Server_Handler, ACE_SOCK_ACCEPTOR>; template class ACE_Acceptor<ACE_TS_Server_Handler, ACE_SOCK_ACCEPTOR>; template class ACE_Concurrency_Strategy<ACE_TS_Server_Handler>; @@ -240,4 +240,14 @@ template class ACE_Schedule_All_Reactive_Strategy<ACE_TS_Server_Handler>; template class ACE_Scheduling_Strategy<ACE_TS_Server_Handler>; template class ACE_Strategy_Acceptor<ACE_TS_Server_Handler, ACE_SOCK_ACCEPTOR>; template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Accept_Strategy<ACE_TS_Server_Handler, ACE_SOCK_ACCEPTOR> +#pragma instantiate ACE_Acceptor<ACE_TS_Server_Handler, ACE_SOCK_ACCEPTOR> +#pragma instantiate ACE_Concurrency_Strategy<ACE_TS_Server_Handler> +#pragma instantiate ACE_Creation_Strategy<ACE_TS_Server_Handler> +#pragma instantiate ACE_Schedule_All_Reactive_Strategy<ACE_TS_Server_Handler> +#pragma instantiate ACE_Scheduling_Strategy<ACE_TS_Server_Handler> +#pragma instantiate ACE_Strategy_Acceptor<ACE_TS_Server_Handler, ACE_SOCK_ACCEPTOR> +#pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + diff --git a/netsvcs/lib/Token_Handler.cpp b/netsvcs/lib/Token_Handler.cpp index 0a520bc6afa..1c13a1dd4a1 100644 --- a/netsvcs/lib/Token_Handler.cpp +++ b/netsvcs/lib/Token_Handler.cpp @@ -26,7 +26,7 @@ ACE_Token_Acceptor::parse_args (int argc, char *argv[]) this->service_port_ = ACE_OS::atoi (get_opt.optarg); break; default: - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, "%n:\n[-p server-port]\n%a", 1), -1); } @@ -48,11 +48,11 @@ ACE_Token_Acceptor::init (int argc, char *argv[]) // Set the acceptor endpoint into listen mode (use the Singleton // global Reactor...). if (this->open (this->service_addr_, ACE_Reactor::instance (), - 0, 0, 0, + 0, 0, 0, &this->scheduling_strategy_, "Token Server", "ACE token service") == -1) - ACE_ERROR_RETURN ((LM_ERROR, "%n: %p on port %d\n", - "acceptor::open failed", + ACE_ERROR_RETURN ((LM_ERROR, "%n: %p on port %d\n", + "acceptor::open failed", this->service_addr_.get_port_number ()), -1); // Ignore SIGPIPE so that each <SVC_HANDLER> can handle this on its @@ -64,9 +64,9 @@ ACE_Token_Acceptor::init (int argc, char *argv[]) if (this->acceptor ().get_local_addr (server_addr) == -1) ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "get_remote_addr"), -1); - - ACE_DEBUG ((LM_DEBUG, - "starting up Token Server at port %d on handle %d\n", + + ACE_DEBUG ((LM_DEBUG, + "starting up Token Server at port %d on handle %d\n", server_addr.get_port_number (), this->acceptor ().get_handle ())); return 0; @@ -90,7 +90,7 @@ ACE_Token_Handler::ACE_Token_Handler (ACE_Thread_Manager *tm) // Create and send a reply to the client. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Token_Handler::send_reply (ACE_UINT32 err) { ACE_TRACE ("ACE_Token_Handler::send_reply"); @@ -105,7 +105,7 @@ ACE_Token_Handler::send_reply (ACE_UINT32 err) n = this->peer ().send (buf, len); if (n != (ssize_t) len) - ACE_ERROR_RETURN ((LM_ERROR, + ACE_ERROR_RETURN ((LM_ERROR, "%p, expected len = %d, actual len = %d\n", "send failed", len, n), -1); else @@ -114,11 +114,11 @@ ACE_Token_Handler::send_reply (ACE_UINT32 err) // Acquire the token. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Token_Handler::acquire (ACE_Token_Proxy *proxy) { ACE_TRACE ("ACE_Token_Handler::acquire"); - ACE_DEBUG ((LM_DEBUG, "in acquire for client id = %s\n", + ACE_DEBUG ((LM_DEBUG, "in acquire for client id = %s\n", proxy->client_id ())); // @@ add notify in token request reply @@ -137,7 +137,7 @@ ACE_Token_Handler::acquire (ACE_Token_Proxy *proxy) return this->send_reply (EWOULDBLOCK); // schedule a timer - this->timeout_id_ = this->reactor ()->schedule_timer + this->timeout_id_ = this->reactor ()->schedule_timer (this, (void *) proxy, request_options_.timeout ()); if (timeout_id_ == -1) { @@ -155,7 +155,7 @@ ACE_Token_Handler::acquire (ACE_Token_Proxy *proxy) // Try to acquire the token. Never block. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Token_Handler::try_acquire (ACE_Token_Proxy *proxy) { ACE_TRACE ("ACE_Token_Handler::try_acquire"); @@ -173,12 +173,12 @@ ACE_Token_Handler::try_acquire (ACE_Token_Proxy *proxy) // Release the token and allow the next client that is waiting to // proceed. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Token_Handler::release (ACE_Token_Proxy *proxy) { ACE_TRACE ("ACE_Token_Handler::release"); - ACE_DEBUG ((LM_DEBUG, - "in release for client id = %s\n", + ACE_DEBUG ((LM_DEBUG, + "in release for client id = %s\n", proxy->client_id ())); if (proxy->release (ACE_Synch_Options::asynch) == -1) @@ -191,22 +191,22 @@ ACE_Token_Handler::release (ACE_Token_Proxy *proxy) this->reactor ()->cancel_timer (timeout_id_); this->timeout_id_ = 0; } - + return this->send_reply (ACE_Token_Reply::SUCCESS); } // Yield the token if any clients are waiting, otherwise keep the // token. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Token_Handler::renew (ACE_Token_Proxy *proxy) { ACE_TRACE ("ACE_Token_Handler::renew"); - ACE_DEBUG ((LM_DEBUG, "in renew for client id = %s\n", + ACE_DEBUG ((LM_DEBUG, "in renew for client id = %s\n", proxy->client_id ())); - if (proxy->renew (token_request_.requeue_position (), + if (proxy->renew (token_request_.requeue_position (), ACE_Synch_Options::asynch) == -1) { int result = ACE_LOG_MSG->errnum (); @@ -217,7 +217,7 @@ ACE_Token_Handler::renew (ACE_Token_Proxy *proxy) // acquire would block if (request_options_[ACE_Synch_Options::USE_TIMEOUT] == 1) { - this->timeout_id_ = this->reactor ()->schedule_timer + this->timeout_id_ = this->reactor ()->schedule_timer (this, 0, request_options_.timeout ()); if (timeout_id_ == -1) { @@ -234,11 +234,11 @@ ACE_Token_Handler::renew (ACE_Token_Proxy *proxy) return this->send_reply (ACE_Token_Reply::SUCCESS); } -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Token_Handler::remove (ACE_Token_Proxy *proxy) { ACE_TRACE ("ACE_Token_Handler::remove"); - ACE_DEBUG ((LM_DEBUG, "in remove for client id = %s\n", + ACE_DEBUG ((LM_DEBUG, "in remove for client id = %s\n", proxy->client_id ())); ACE_ERROR ((LM_ERROR, "sorry: ACE_Token_Handler::remove() is not implemented")); @@ -248,8 +248,8 @@ ACE_Token_Handler::remove (ACE_Token_Proxy *proxy) // Enable clients to limit the amount of time they'll wait for a // token. -/* VIRTUAL */ int -ACE_Token_Handler::handle_timeout (const ACE_Time_Value &, +/* VIRTUAL */ int +ACE_Token_Handler::handle_timeout (const ACE_Time_Value &, const void *tp) { ACE_TRACE ("ACE_Token_Handler::handle_timeout"); @@ -264,7 +264,7 @@ ACE_Token_Handler::handle_timeout (const ACE_Time_Value &, ACE_Token_Proxy *proxy = (ACE_Token_Proxy *) tp; - ACE_DEBUG ((LM_DEBUG, "in handle_timeout for client id = %s\n", + ACE_DEBUG ((LM_DEBUG, "in handle_timeout for client id = %s\n", proxy->client_id ())); // Remove ourselves from the waiter list. @@ -314,12 +314,12 @@ ACE_Token_Handler::create_proxy (void) ACE_TRACE ("ACE_Token_Handler::new_proxy"); ACE_Token_Proxy *proxy; - + switch (token_request_.token_type ()) { case ACE_Tokens::RWLOCK: if (token_request_.proxy_type () == ACE_RW_Token::READER) - ACE_NEW_RETURN (proxy, + ACE_NEW_RETURN (proxy, ACE_TS_RLock (token_request_.token_name (), this), 0); else @@ -373,11 +373,11 @@ ACE_Token_Handler::dispatch (void) /* NOTREACHED */ } } - + // Receive, frame, and decode the client's request. // Note, this method should use non-blocking I/O. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Token_Handler::recv_request (void) { ACE_TRACE ("ACE_Token_Handler::recv_request"); @@ -386,7 +386,7 @@ ACE_Token_Handler::recv_request (void) // Read the first 4 bytes to get the length of the message // This implementation assumes that the first 4 bytes are // the length of the message. - n = this->peer ().recv ((void *) &this->token_request_, + n = this->peer ().recv ((void *) &this->token_request_, sizeof (ACE_UINT32)); switch (n) @@ -394,7 +394,7 @@ ACE_Token_Handler::recv_request (void) case -1: /* FALLTHROUGH */ default: - ACE_ERROR ((LM_ERROR, "%p got %d bytes, expected %d bytes\n", + ACE_ERROR ((LM_ERROR, "%p got %d bytes, expected %d bytes\n", "recv failed", n, sizeof (ACE_UINT32))); /* FALLTHROUGH */ case 0: @@ -417,13 +417,13 @@ ACE_Token_Handler::recv_request (void) // Receive the rest of the request message. // @@ beware of blocking read!!!. n = this->peer ().recv ((void *) (((char *) &this->token_request_) - + sizeof (ACE_UINT32)), + + sizeof (ACE_UINT32)), length - sizeof (ACE_UINT32)); - + // Subtract off the size of the part we skipped over... if (n != (length - (ssize_t) sizeof (ACE_UINT32))) { - ACE_ERROR ((LM_ERROR, "%p expected %d, got %d\n", + ACE_ERROR ((LM_ERROR, "%p expected %d, got %d\n", "invalid length", length, n)); return this->abandon (1); } @@ -442,10 +442,10 @@ ACE_Token_Handler::recv_request (void) return 0; } -// Callback method invoked by the ACE_Reactor when +// Callback method invoked by the ACE_Reactor when // events arrive from the client. -/* VIRTUAL */ int +/* VIRTUAL */ int ACE_Token_Handler::handle_input (ACE_HANDLE) { ACE_TRACE ("ACE_Token_Handler::handle_input"); @@ -476,7 +476,7 @@ ACE_Token_Handler::token_acquired (ACE_TPQ_Entry *) this->reactor ()->cancel_timer (this->timeout_id_); this->timeout_id_ = 0; } - + this->send_reply (ACE_Token_Reply::SUCCESS); } @@ -494,7 +494,7 @@ ACE_Token_Handler::abandon (int send_error) // @@ release all tokens collection_.release (); - + if (send_error) return this->send_reply (EIO); else @@ -521,7 +521,7 @@ ACE_TS_Mutex::ACE_TS_Mutex (const ACE_TS_Mutex &m) this->open (m.name (), m.ignore_deadlock_, m.debug_); } -void +void ACE_TS_Mutex::sleep_hook (void) { ACE_TRACE ("ACE_TS_Mutex::sleep_hook"); @@ -565,7 +565,7 @@ ACE_TS_RLock::ACE_TS_RLock (const ACE_TS_RLock &r) this->open (r.name (), r.ignore_deadlock_, r.debug_); } -void +void ACE_TS_RLock::sleep_hook (void) { ACE_TRACE ("ACE_TS_RLock::sleep_hook"); @@ -587,7 +587,7 @@ ACE_TS_RLock::clone (void) const { ACE_TRACE ("ACE_TS_RLock::clone"); ACE_Token_Proxy *temp; - + ACE_NEW_RETURN (temp, ACE_TS_RLock (*this), 0); return temp; } @@ -610,7 +610,7 @@ ACE_TS_WLock::ACE_TS_WLock (const ACE_TS_WLock &w) this->open (w.name (), w.ignore_deadlock_, w.debug_); } -void +void ACE_TS_WLock::sleep_hook (void) { ACE_TRACE ("ACE_TS_WLock::sleep_hook"); @@ -632,12 +632,12 @@ ACE_TS_WLock::clone (void) const { ACE_TRACE ("ACE_TS_WLock::clone"); ACE_Token_Proxy *temp; - + ACE_NEW_RETURN (temp, ACE_TS_WLock (*this), 0); return temp; } -#if defined (ACE_TEMPLATES_REQUIRE_SPECIALIZATION) +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Acceptor<ACE_Token_Handler, ACE_SOCK_ACCEPTOR>; template class ACE_Accept_Strategy<ACE_Token_Handler, ACE_SOCK_ACCEPTOR>; template class ACE_Concurrency_Strategy<ACE_Token_Handler>; @@ -645,4 +645,13 @@ template class ACE_Creation_Strategy<ACE_Token_Handler>; template class ACE_Schedule_All_Reactive_Strategy<ACE_Token_Handler>; template class ACE_Scheduling_Strategy<ACE_Token_Handler>; template class ACE_Strategy_Acceptor<ACE_Token_Handler, ACE_SOCK_ACCEPTOR>; -#endif /* ACE_TEMPLATES_REQUIRE_SPECIALIZATION */ +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Acceptor<ACE_Token_Handler, ACE_SOCK_ACCEPTOR> +#pragma instantiate ACE_Accept_Strategy<ACE_Token_Handler, ACE_SOCK_ACCEPTOR> +#pragma instantiate ACE_Concurrency_Strategy<ACE_Token_Handler> +#pragma instantiate ACE_Creation_Strategy<ACE_Token_Handler> +#pragma instantiate ACE_Schedule_All_Reactive_Strategy<ACE_Token_Handler> +#pragma instantiate ACE_Scheduling_Strategy<ACE_Token_Handler> +#pragma instantiate ACE_Strategy_Acceptor<ACE_Token_Handler, ACE_SOCK_ACCEPTOR> +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ + |