summaryrefslogtreecommitdiff
path: root/netsvcs/lib/Token_Handler.cpp
diff options
context:
space:
mode:
authorlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-07-31 21:48:20 +0000
committerlevine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-07-31 21:48:20 +0000
commit86c5f836d1a679208716a422839d7da38ba41059 (patch)
tree1b3da514a0eb2064d0b27c62011db9492387b7dc /netsvcs/lib/Token_Handler.cpp
parent13c10349a654c59c85bb62c7f7b9ab8e1424814c (diff)
downloadATCD-86c5f836d1a679208716a422839d7da38ba41059.tar.gz
added ACE_HAS_INSTANTIATION_PRAGMA support
Diffstat (limited to 'netsvcs/lib/Token_Handler.cpp')
-rw-r--r--netsvcs/lib/Token_Handler.cpp101
1 files changed, 55 insertions, 46 deletions
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 */
+