本文整理汇总了C++中ACE_BIT_DISABLED函数的典型用法代码示例。如果您正苦于以下问题:C++ ACE_BIT_DISABLED函数的具体用法?C++ ACE_BIT_DISABLED怎么用?C++ ACE_BIT_DISABLED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACE_BIT_DISABLED函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ACE_TRACE
void
ACE_DLL_Manager::unload_policy (u_long unload_policy)
{
ACE_TRACE ("ACE_DLL_Manager::unload_policy");
ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_mon, this->lock_));
u_long old_policy = this->unload_policy_;
this->unload_policy_ = unload_policy;
// If going from LAZY to EAGER or from PER_DLL to PER_PROCESS|EAGER,
// call close(1) on all the ACE_DLL_Handle objects with refcount == 0
// which will force those that are still loaded to be unloaded.
if (this->handle_vector_)
if (( ACE_BIT_ENABLED (old_policy, ACE_DLL_UNLOAD_POLICY_LAZY) &&
ACE_BIT_DISABLED (this->unload_policy_, ACE_DLL_UNLOAD_POLICY_LAZY) ) ||
( ACE_BIT_DISABLED (this->unload_policy_, ACE_DLL_UNLOAD_POLICY_LAZY) &&
ACE_BIT_ENABLED (old_policy, ACE_DLL_UNLOAD_POLICY_PER_DLL) &&
ACE_BIT_DISABLED (this->unload_policy_, ACE_DLL_UNLOAD_POLICY_PER_DLL) ))
{
for (int i = this->current_size_ - 1; i >= 0; i--)
{
if (this->handle_vector_[i] &&
this->handle_vector_[i]->refcount () == 0)
this->handle_vector_[i]->close (1);
}
}
}
开发者ID:yuanxu,项目名称:liveshow_r2,代码行数:27,代码来源:DLL_Manager.cpp
示例2: ACE_TRACE
int
ACE_DLL_Manager::unload_dll (ACE_DLL_Handle *dll_handle, int force_unload)
{
ACE_TRACE ("ACE_DLL_Manager::unload_dll");
if (dll_handle)
{
int unload = force_unload;
if (unload == 0)
{
// apply strategy
if (ACE_BIT_DISABLED (this->unload_policy_,
ACE_DLL_UNLOAD_POLICY_PER_DLL))
{
unload = ACE_BIT_DISABLED (this->unload_policy_,
ACE_DLL_UNLOAD_POLICY_LAZY);
}
else
{
// Declare the type of the symbol:
typedef int (*dll_unload_policy)(void);
dll_unload_policy the_policy = 0;
void *unload_policy_ptr =
dll_handle->symbol (ACE_LIB_TEXT ("_get_dll_unload_policy"), 1);
ptrdiff_t temp_p =
reinterpret_cast<ptrdiff_t> (unload_policy_ptr);
the_policy =
reinterpret_cast<dll_unload_policy> (temp_p);
if (the_policy != 0)
unload = ACE_BIT_DISABLED (the_policy (),
ACE_DLL_UNLOAD_POLICY_LAZY);
else
unload = ACE_BIT_DISABLED (this->unload_policy_,
ACE_DLL_UNLOAD_POLICY_LAZY);
}
}
if (dll_handle->close (unload) != 0)
{
if (ACE::debug ())
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("ACE_DLL_Manager::unload error.\n")));
return -1;
}
}
else
{
if (ACE::debug ())
ACE_ERROR ((LM_ERROR,
ACE_LIB_TEXT ("ACE_DLL_Manager::unload_dll called with ")
ACE_LIB_TEXT ("null pointer.\n")));
return -1;
}
return 0;
}
开发者ID:mbert,项目名称:mulberry-lib-jx,代码行数:58,代码来源:DLL_Manager.cpp
示例3: ACE_TRACE
int
ACE_Data_Block::size (size_t length)
{
ACE_TRACE ("ACE_Data_Block::size");
if (length <= this->max_size_)
this->cur_size_ = length;
else
{
// We need to resize!
char *buf = 0;
ACE_ALLOCATOR_RETURN (buf,
(char *) this->allocator_strategy_->malloc (length),
-1);
ACE_OS::memcpy (buf,
this->base_,
this->cur_size_);
if (ACE_BIT_DISABLED (this->flags_,
ACE_Message_Block::DONT_DELETE))
this->allocator_strategy_->free ((void *) this->base_);
else
// We now assume ownership.
ACE_CLR_BITS (this->flags_,
ACE_Message_Block::DONT_DELETE);
this->max_size_ = length;
this->cur_size_ = length;
this->base_ = buf;
}
return 0;
}
开发者ID:Archives,项目名称:try,代码行数:31,代码来源:Message_Block.cpp
示例4:
// Helper method
CORBA::NamedValue_ptr
CORBA::NVList::add_element (CORBA::Flags flags)
{
this->evaluate ();
if (ACE_BIT_DISABLED (flags,
CORBA::ARG_IN | CORBA::ARG_OUT | CORBA::ARG_INOUT))
{
throw ::CORBA::BAD_PARAM ();
}
CORBA::NamedValue_ptr nv;
// allocate a new NamedValue
ACE_NEW_THROW_EX (nv,
CORBA::NamedValue,
CORBA::NO_MEMORY ());
// set the flags and enqueue in the queue
nv->flags_ = flags;
if (this->values_.enqueue_tail (nv) == -1)
{
delete nv;
return 0;
}
++this->max_;
return nv; // success
}
开发者ID:CCJY,项目名称:ATCD,代码行数:31,代码来源:NVList.cpp
示例5: ACE_TRACE
int
ACE_SOCK_Acceptor::shared_accept_start (ACE_Time_Value *timeout,
int restart,
int &in_blocking_mode) const
{
ACE_TRACE ("ACE_SOCK_Acceptor::shared_accept_start");
ACE_HANDLE handle = this->get_handle ();
// Handle the case where we're doing a timed <accept>.
if (timeout != 0)
{
if (ACE::handle_timed_accept (handle,
timeout,
restart) == -1)
return -1;
else
{
in_blocking_mode = ACE_BIT_DISABLED (ACE::get_flags (handle),
ACE_NONBLOCK);
// Set the handle into non-blocking mode if it's not already
// in it.
if (in_blocking_mode
&& ACE::set_flags (handle,
ACE_NONBLOCK) == -1)
return -1;
}
}
return 0;
}
开发者ID:1ATOM,项目名称:mangos,代码行数:31,代码来源:SOCK_Acceptor.cpp
示例6: catch
int
TAO_DII_Asynch_Reply_Dispatcher::dispatch_reply (
TAO_Pluggable_Reply_Params ¶ms)
{
this->reply_status_ = params.reply_status ();
this->locate_reply_status_ = params.locate_reply_status ();
// Transfer the <params.input_cdr_>'s content to this->reply_cdr_
ACE_Data_Block *db =
this->reply_cdr_.clone_from (*params.input_cdr_);
// See whether we need to delete the data block by checking the
// flags. We cannot be happy that we initally allocated the
// datablocks of the stack. If this method is called twice, as is in
// some cases where the same invocation object is used to make two
// invocations like forwarding, the release becomes essential.
if (ACE_BIT_DISABLED (db->flags (),
ACE_Message_Block::DONT_DELETE))
db->release ();
// Steal the buffer, that way we don't do any unnecesary copies of
// this data.
CORBA::ULong max = params.svc_ctx_.maximum ();
CORBA::ULong len = params.svc_ctx_.length ();
IOP::ServiceContext* context_list = params.svc_ctx_.get_buffer (1);
this->reply_service_info_.replace (max, len, context_list, 1);
if (TAO_debug_level >= 4)
{
TAOLIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%P | %t):")
ACE_TEXT ("TAO_DII_Asynch_Reply_Dispatcher::dispatch_reply: status = %d\n"),
this->reply_status_));
}
try
{
// Call the handler with the reply data.
CORBA::Request::_tao_reply_stub (this->reply_cdr_,
this->callback_,
this->reply_status_);
}
catch (const CORBA::Exception& ex)
{
if (TAO_debug_level >= 4)
{
ex._tao_print_exception ("Exception during reply handler");
}
}
// This was dynamically allocated. Now the job is done.
this->intrusive_remove_ref (this);
return 1;
}
开发者ID:akostrikov,项目名称:ATCD,代码行数:54,代码来源:DII_Reply_Dispatcher.cpp
示例7:
int
Sender::terminate_io (ACE_Reactor_Mask mask)
{
if (ACE_BIT_DISABLED (flg_mask_, mask))
return 0;
if (ACE_Reactor::instance ()->cancel_wakeup (this, mask) == -1)
return -1;
ACE_CLR_BITS (flg_mask_, mask);
return 0;
}
开发者ID:azraelly,项目名称:knetwork,代码行数:12,代码来源:TP_Reactor_Test.cpp
示例8:
void
ACE_Data_Block::base (char *msg_data,
size_t msg_length,
ACE_Message_Block::Message_Flags msg_flags)
{
if (ACE_BIT_DISABLED (this->flags_,
ACE_Message_Block::DONT_DELETE))
this->allocator_strategy_->free (this->base_);
this->max_size_ = msg_length;
this->cur_size_ = msg_length;
this->base_ = msg_data;
this->flags_ = msg_flags;
}
开发者ID:Archives,项目名称:try,代码行数:14,代码来源:Message_Block.cpp
示例9: ACE_ASSERT
ACE_Data_Block::~ACE_Data_Block (void)
{
// Sanity check...
ACE_ASSERT (this->reference_count_ <= 1);
// Just to be safe...
this->reference_count_ = 0;
if (ACE_BIT_DISABLED (this->flags_,
ACE_Message_Block::DONT_DELETE))
{
this->allocator_strategy_->free ((void *) this->base_);
this->base_ = 0;
}
}
开发者ID:Archives,项目名称:try,代码行数:15,代码来源:Message_Block.cpp
示例10: ACE_BIT_DISABLED
int
TAO::SSLIOP::Acceptor::verify_secure_configuration (TAO_ORB_Core *orb_core,
int major,
int minor)
{
// Sanity check.
if (major < 1)
{
// There is no such thing as IIOP 0.x.
errno = EINVAL;
return -1;
}
// In order to support a secure connection, the SSLIOP::SSL tagged
// component must be embedded in the IOR. This isn't possible if
// the user elects to disable standard profile components.
// Similarly, IIOP 1.0 does not support tagged components, which
// makes it impossible to embed the SSLIOP::SSL tagged component
// within the IOR. If the given object explicitly disallows
// insecure invocations and standard profile components are
// disabled, then return with an error since secure invocations
// cannot be supported without standard profile components.
//
// Note that it isn't enough to support NoProtection. NoProtection
// must be required since "support" does not preclude the secure
// port from being used.
if ((orb_core->orb_params ()->std_profile_components () == 0
|| (major == 1 && minor == 0))
&& ACE_BIT_DISABLED (this->ssl_component_.target_requires,
::Security::NoProtection))
{
if (TAO_debug_level > 0)
ORBSVCS_ERROR ((LM_ERROR,
ACE_TEXT ("(%P|%t) Cannot support secure ")
ACE_TEXT ("IIOP over SSL connection if\n")
ACE_TEXT ("(%P|%t) standard profile ")
ACE_TEXT ("components are disabled\n")
ACE_TEXT ("(%P|%t) or IIOP 1.0 endpoint is ")
ACE_TEXT ("used.\n")));
errno = EINVAL;
return -1;
}
return 0;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:47,代码来源:SSLIOP_Acceptor.cpp
示例11: TAOLIB_DEBUG
void
CORBA::NVList::_tao_decode (TAO_InputCDR &incoming, int flag)
{
if (TAO_debug_level > 3)
{
TAOLIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) : NVList::_tao_decode\n")));
}
// Then unmarshal each "in" and "inout" parameter.
ACE_Unbounded_Queue_Iterator<CORBA::NamedValue_ptr> i (this->values_);
for (i.first (); !i.done (); i.advance ())
{
CORBA::NamedValue_ptr *item = 0;
(void) i.next (item);
CORBA::NamedValue_ptr nv = *item;
// check if it is an in or inout parameter
// @@ this is where we assume that the NVList is coming from
// a Server-side request, we could probably handle both
// cases with a flag, but there is no clear need for that.
if (ACE_BIT_DISABLED (nv->flags (), flag))
{
continue;
}
if (TAO_debug_level > 3)
{
TAOLIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) : NVList::_tao_decode - %C\n"),
nv->name ()? nv->name () : "(no name given)" ));
}
CORBA::Any_ptr any = nv->value ();
any->impl ()->_tao_decode (incoming
);
}
}
开发者ID:CCJY,项目名称:ATCD,代码行数:40,代码来源:NVList.cpp
示例12: run_main
int
run_main (int argc, ACE_TCHAR *argv[])
{
int retval = 0;
MCT_Config config;
retval = config.open (argc, argv);
if (retval != 0)
return 1;
const ACE_TCHAR *temp = ACE_TEXT ("Multicast_Test");
ACE_TString test = temp;
u_long role = config.role ();
if (ACE_BIT_DISABLED (role, MCT_Config::PRODUCER)
|| ACE_BIT_DISABLED (role, MCT_Config::CONSUMER))
{
if (ACE_BIT_ENABLED (role, MCT_Config::PRODUCER))
test += ACE_TEXT ("-PRODUCER");
else
test += ACE_TEXT ("-CONSUMER");
}
// Start test only if options are valid.
ACE_START_TEST (test.c_str ());
// Register a signal handler to close down application gracefully.
ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
// Dump the configuration info to the log if caller passed debug option.
if (config.debug ())
config.dump ();
ACE_Reactor *reactor = ACE_Reactor::instance ();
MCT_Task *task = new MCT_Task (config, reactor);
if (ACE_BIT_ENABLED (role, MCT_Config::CONSUMER))
{
ACE_DEBUG ((LM_INFO, ACE_TEXT ("Starting consumer...\n")));
// Open makes it an active object.
retval += task->open ();
}
// now produce the datagrams...
if (ACE_BIT_ENABLED (role, MCT_Config::PRODUCER))
retval += producer (config);
if (ACE_BIT_ENABLED (role, MCT_Config::CONSUMER))
{
// and wait for everything to finish
ACE_DEBUG ((LM_INFO,
ACE_TEXT ("start waiting for consumer to finish...\n")));
// Wait for the threads to exit.
// But, wait for a limited time since we could hang if the last udp
// message isn't received.
ACE_Time_Value max_wait ( config.wait ()/* seconds */);
ACE_Time_Value wait_time (ACE_OS::gettimeofday () + max_wait);
ACE_Time_Value *ptime = ACE_BIT_ENABLED (role, MCT_Config::PRODUCER)
? &wait_time : 0;
if (ACE_Thread_Manager::instance ()->wait (ptime) == -1)
{
// We will no longer wait for this thread, so we must
// force it to exit otherwise the thread will be referencing
// deleted memory.
finished = 1;
reactor->end_reactor_event_loop ();
if (errno == ETIME)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("maximum wait time of %d msec exceeded\n"),
max_wait.msec ()));
else
ACE_OS::perror (ACE_TEXT ("wait"));
++error;
// This should exit now that we ended the reactor loop.
task->wait ();
}
}
delete task;
ACE_END_TEST;
return (retval == 0 && error == 0) ? 0 : 1;
}
开发者ID:CCJY,项目名称:ACE,代码行数:85,代码来源:Multicast_Test.cpp
示例13: TAOLIB_ERROR
// Dispatch the reply.
int
TAO_Asynch_Reply_Dispatcher::dispatch_reply (TAO_Pluggable_Reply_Params ¶ms)
{
if (this->timeout_handler_)
{
// If we had registered timeout handlers just cancel them and
// loose ownership of the handlers
this->timeout_handler_->cancel ();
this->timeout_handler_->remove_reference ();
this->timeout_handler_ = 0;
// AMI Timeout Handling End
}
// With Asynch requests the invocation handler can't call idle_after_reply ()
// since it does not handle the reply.
// So we have to do that here in case f.i. the Exclusive TMS left the transport
// busy after the send
if (this->transport_ != 0)
this->transport_->tms ()->idle_after_reply ();
if (!params.input_cdr_)
return -1;
if (!this->try_dispatch_reply ())
return 0;
this->reply_status_ = params.reply_status ();
this->locate_reply_status_ = params.locate_reply_status ();
// Transfer the <params.input_cdr_>'s content to this->reply_cdr_
ACE_Data_Block *db = this->reply_cdr_.clone_from (*params.input_cdr_);
if (db == 0)
{
if (TAO_debug_level > 2)
{
TAOLIB_ERROR ((
LM_ERROR,
ACE_TEXT ("TAO_Messaging (%P|%t) - Asynch_Reply_Dispatcher::dispatch_reply ")
ACE_TEXT ("clone_from failed\n")));
}
return -1;
}
// See whether we need to delete the data block by checking the
// flags. We cannot be happy that we initially allocated the
// datablocks of the stack. If this method is called twice, as is in
// some cases where the same invocation object is used to make two
// invocations like forwarding, the release becomes essential.
if (ACE_BIT_DISABLED (db->flags (), ACE_Message_Block::DONT_DELETE))
{
db->release ();
}
if (!CORBA::is_nil (this->reply_handler_.in ()))
{
// Steal the buffer, that way we don't do any unnecesary copies of
// this data.
CORBA::ULong const max = params.svc_ctx_.maximum ();
CORBA::ULong const len = params.svc_ctx_.length ();
IOP::ServiceContext *context_list = params.svc_ctx_.get_buffer (1);
this->reply_service_info_.replace (max, len, context_list, 1);
if (TAO_debug_level >= 4)
{
TAOLIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO_Messaging (%P|%t) - Asynch_Reply_Dispatcher")
ACE_TEXT ("::dispatch_reply status = %d\n"),
this->reply_status_));
}
CORBA::ULong reply_error = TAO_AMI_REPLY_NOT_OK;
switch (this->reply_status_)
{
case GIOP::NO_EXCEPTION:
reply_error = TAO_AMI_REPLY_OK;
break;
case GIOP::USER_EXCEPTION:
reply_error = TAO_AMI_REPLY_USER_EXCEPTION;
break;
case GIOP::SYSTEM_EXCEPTION:
reply_error = TAO_AMI_REPLY_SYSTEM_EXCEPTION;
break;
case GIOP::LOCATION_FORWARD:
reply_error = TAO_AMI_REPLY_LOCATION_FORWARD;
break;
case GIOP::LOCATION_FORWARD_PERM:
reply_error = TAO_AMI_REPLY_LOCATION_FORWARD_PERM;
break;
default:
// @@ Michael: Not even the spec mentions this case.
// We have to think about this case.
// Handle the forwarding and return so the stub restarts the
// request!
reply_error = TAO_AMI_REPLY_NOT_OK;
break;
}
//.........这里部分代码省略.........
开发者ID:akostrikov,项目名称:ATCD,代码行数:101,代码来源:Asynch_Reply_Dispatcher.cpp
示例14: process_service_contexts
int
TAO_Synch_Reply_Dispatcher::dispatch_reply (
TAO_Pluggable_Reply_Params ¶ms)
{
if (params.input_cdr_ == 0)
return -1;
this->reply_status_ = params.reply_status ();
this->locate_reply_status_ = params.locate_reply_status ();
// Steal the buffer, that way we don't do any unnecesary copies of
// this data.
CORBA::ULong const max = params.svc_ctx_.maximum ();
CORBA::ULong const len = params.svc_ctx_.length ();
IOP::ServiceContext* context_list = params.svc_ctx_.get_buffer (true);
this->reply_service_info_.replace (max, len, context_list, true);
if (this->reply_service_info_.length() > 0)
{
orb_core_->service_context_registry ().
process_service_contexts (this->reply_service_info_, *(params.transport_), 0);
}
// Must reset the message state, it is possible that the same reply
// dispatcher is used because the request must be re-sent.
// this->message_state_.reset (0);
// Transfer the <params.input_cdr_>'s content to this->reply_cdr_
if (ACE_BIT_DISABLED ((*params.input_cdr_).start()->data_block()->flags(),
ACE_Message_Block::DONT_DELETE))
{
// Data block is on the heap, so just duplicate it.
this->reply_cdr_ = *params.input_cdr_;
this->reply_cdr_.clr_mb_flags (ACE_Message_Block::DONT_DELETE);
}
else
{
ACE_Data_Block *db = this->reply_cdr_.clone_from (*params.input_cdr_);
if (db == 0)
{
if (TAO_debug_level > 2)
{
TAOLIB_ERROR ((LM_ERROR,
"TAO (%P|%t) - Synch_Reply_Dispatcher::dispatch_reply "
"clone_from failed\n"));
}
return -1;
}
// See whether we need to delete the data block by checking the
// flags. We cannot be happy that we initally allocated the
// datablocks of the stack. If this method is called twice, as is in
// some cases where the same invocation object is used to make two
// invocations like forwarding, the release becomes essential.
if (ACE_BIT_DISABLED (db->flags (),
ACE_Message_Block::DONT_DELETE))
{
db->release ();
}
}
this->state_changed (TAO_LF_Event::LFS_SUCCESS,
this->orb_core_->leader_follower ());
return 1;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:67,代码来源:Synch_Reply_Dispatcher.cpp
示例15: ACE_TRACE
int
ACE_SOCK_Dgram_Mcast::open_i (const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if,
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::open_i");
// ACE_SOCK::open calls this if reuse_addr is set, so we only need to
// process port reuse option.
if (reuse_addr)
{
#if defined (SO_REUSEPORT)
int one = 1;
if (this->ACE_SOCK::set_option (SOL_SOCKET,
SO_REUSEPORT,
&one,
sizeof one) == -1)
return -1;
#endif /* SO_REUSEPORT */
}
// Create an address/port# to bind the socket to. Use mcast_addr to
// initialize bind_addy to pick up the correct protocol family. If
// OPT_BINDADDR_YES is set, then we're done. Else use mcast_addr's
// port number and use the "any" address.
ACE_INET_Addr bind_addy (mcast_addr);
if (ACE_BIT_DISABLED (this->opts_, OPT_BINDADDR_YES))
{
#if defined (ACE_HAS_IPV6)
if (mcast_addr.get_type () == PF_INET6)
{
if (bind_addy.set (mcast_addr.get_port_number (), "::",
1, AF_INET6) == -1)
return -1;
}
else
// Bind to "any" address and explicit port#.
if (bind_addy.set (mcast_addr.get_port_number ()) == -1)
return -1;
#else
// Bind to "any" address and explicit port#.
if (bind_addy.set (mcast_addr.get_port_number ()) == -1)
return -1;
#endif /* ACE_HAS_IPV6 */
}
// Bind to the address (which may be INADDR_ANY) and port# (which may be 0)
if (ACE_SOCK_Dgram::shared_open (bind_addy, bind_addy.get_type ()) == -1)
return -1;
// Cache the actual bound address (which may be INADDR_ANY)
// and the actual bound port# (which will be a valid, non-zero port#).
ACE_INET_Addr bound_addy;
if (this->get_local_addr (bound_addy) == -1)
{
// (Unexpected failure - should be bound to something)
if (bound_addy.set (bind_addy) == -1)
{
// (Shouldn't happen - bind_addy is a valid addy; punt.)
return -1;
}
}
this->send_addr_ = mcast_addr;
this->send_addr_.set_port_number (bound_addy.get_port_number ());
if (net_if)
{
if (this->set_nic (net_if, mcast_addr.get_type ()))
return -1;
this->send_net_if_ = new ACE_TCHAR[ACE_OS::strlen (net_if) + 1];
ACE_OS::strcpy (this->send_net_if_, net_if);
}
return 0;
}
开发者ID:Amara1231,项目名称:blizzlikecore,代码行数:75,代码来源:SOCK_Dgram_Mcast.cpp
示例16: ACE_BIT_DISABLED
int
ACE_SSL_SOCK_Acceptor::ssl_accept (ACE_SSL_SOCK_Stream &new_stream,
ACE_Time_Value *timeout) const
{
SSL *ssl = new_stream.ssl ();
if (SSL_is_init_finished (ssl))
return 0;
if (!SSL_in_accept_init (ssl))
::SSL_set_accept_state (ssl);
ACE_HANDLE handle = new_stream.get_handle ();
// We're going to call SSL_accept, optionally doing ACE::select and
// retrying the SSL_accept, until the SSL handshake is done or
// it fails.
// To get the timeout affect, set the socket to nonblocking mode
// before beginning if there is a timeout specified. If the timeout
// is 0 (wait as long as it takes) then don't worry about the blocking
// status; we'll block in SSL_accept if the socket is blocking, and
// block in ACE::select if not.
int reset_blocking_mode = 0;
if (timeout != 0)
{
reset_blocking_mode = ACE_BIT_DISABLED (ACE::get_flags (handle),
ACE_NONBLOCK);
// Set the handle into non-blocking mode if it's not already
// in it.
if (reset_blocking_mode
&& ACE::set_flags (handle,
ACE_NONBLOCK) == -1)
return -1;
}
// Take into account the time between each select() call below.
ACE_Countdown_Time countdown (timeout);
int status;
do
{
// These handle sets are used to set up for whatever SSL_accept
// says it wants next. They're reset on each pass around the loop.
ACE_Handle_Set rd_handle;
ACE_Handle_Set wr_handle;
status = ::SSL_accept (ssl);
switch (::SSL_get_error (ssl, status))
{
case SSL_ERROR_NONE:
status = 0; // To tell caller about success
break; // Done
case SSL_ERROR_WANT_WRITE:
wr_handle.set_bit (handle);
status = 1; // Wait for more activity
break;
case SSL_ERROR_WANT_READ:
rd_handle.set_bit (handle);
status = 1; // Wait for more activity
break;
case SSL_ERROR_ZERO_RETURN:
// The peer has notified us that it is shutting down via
// the SSL "close_notify" message so we need to
// shutdown, too.
status = -1;
break;
case SSL_ERROR_SYSCALL:
// On some platforms (e.g. MS Windows) OpenSSL does not
// store the last error in errno so explicitly do so.
//
// Explicitly check for EWOULDBLOCK since it doesn't get
// converted to an SSL_ERROR_WANT_{READ,WRITE} on some
// platforms. If SSL_accept failed outright, though, don't
// bother checking more. This can happen if the socket gets
// closed during the handshake.
if (ACE_OS::set_errno_to_last_error () == EWOULDBLOCK &&
status == -1)
{
// Although the SSL_ERROR_WANT_READ/WRITE isn't getting
// set correctly, the read/write state should be valid.
// Use that to decide what to do.
status = 1; // Wait for more activity
if (SSL_want_write (ssl))
wr_handle.set_bit (handle);
else if (SSL_want_read (ssl))
rd_handle.set_bit (handle);
else
status = -1; // Doesn't want anything - bail out
}
else
status = -1;
break;
default:
ACE_SSL_Context::report_error ();
status = -1;
//.........这里部分代码省略.........
开发者ID:mbert,项目名称:mulberry-lib-jx,代码行数:101,代码来源:SSL_SOCK_Acceptor.cpp
示例17: _r2tao_invoke_request
static VALUE _r2tao_invoke_request(CORBA::Request_ptr _req, bool& _raise)
{
CORBA::ULong ret_num = 0;
// get the ORB we're using for the request
CORBA::ORB_var _orb = _req->target ()->_get_orb ();
CORBA::TypeCode_var _ret_tc = _req->return_value ().type ();
// invoke twoway if resulttype specified (could be void!)
if (_ret_tc->kind () != CORBA::tk_null)
{
if (_ret_tc->kind () != CORBA::tk_void)
++ret_num;
CORBA::ULong arg_num = _req->arguments ()->count ();
for (CORBA::ULong a=0; a<arg_num ;++a)
{
CORBA::NamedValue_ptr _arg = _req->arguments ()->item (a);
if (ACE_BIT_DISABLED (_arg->flags (), CORBA::ARG_IN))
++ret_num;
}
// invoke request
try
{
_req->invoke ();
}
catch (CORBA::UnknownUserException& user_ex)
{
CORBA::Any& _excany = user_ex.exception ();
CORBA::ULong exc_len = _req->exceptions ()->count ();
for (CORBA::ULong x=0; x<exc_len ;++x)
{
CORBA::TypeCode_var _xtc = _req->exceptions ()->item (x);
if (ACE_OS::strcmp (_xtc->id (),
_excany._tao_get_typecode ()->id ()) == 0)
{
VALUE x_rtc = r2tao_Typecode_t2r(_xtc.in (), _orb.in ());
VALUE rexc = r2tao_Typecode_Any2Ruby (_excany,
_xtc.in (),
x_rtc, x_rtc,
_orb.in ());
_raise = true;
return rexc;
}
}
// rethrow if we were not able to identify the exception
// will be caught and handled in outer exception handler
throw;
}
// handle result and OUT arguments
VALUE result = (ret_num>1 ? rb_ary_new () : Qnil);
if (_ret_tc->kind () != CORBA::tk_void)
{
CORBA::Any& retval = _req->return_value ();
VALUE result_type = r2tao_Typecode_t2r(_ret_tc.in (), _orb.in ());
// return value
if (ret_num>1)
rb_ary_push (result, r2tao_Typecode_Any2Ruby (retval, _ret_tc.in (), result_type, result_type, _orb.in ()));
else
result = r2tao_Typecode_Any2Ruby (retval, _ret_tc.in (), result_type, result_type, _orb.in ());
--ret_num; // return value handled
}
// (in)out args
if (ret_num > 0)
{
for (CORBA::ULong a=0; a<arg_num ;++a)
{
CORBA::NamedValue_ptr _arg = _req->arguments ()->item (a);
if (ACE_BIT_DISABLED (_arg->flags (), CORBA::ARG_IN))
{
CORBA::TypeCode_var _arg_tc = _arg->value ()->type ();
VALUE arg_rtc = r2tao_Typecode_t2r(_arg_tc.in (), _orb.in ());
if (result != Qnil)
rb_ary_push (result, r2tao_Typecode_Any2Ruby (*_arg->value (), _arg_tc.in (), arg_rtc, arg_rtc, _orb.in ()));
else
result = r2tao_Typecode_Any2Ruby (*_arg->value (), _arg_tc.in (), arg_rtc, arg_rtc, _orb.in ());
}
}
}
return result;
}
else // invoke oneway
{
// oneway
_req->send_oneway ();
return Qtrue;
}
}
开发者ID:noda50,项目名称:RubyItk,代码行数:96,代码来源:object.cpp
示例18: data_block_
ACE_Message_Block::ACE_Message_Block (const ACE_Message_Block &mb,
size_t align)
:flags_ (0),
data_block_ (0)
{
ACE_TRACE ("ACE_Message_Block::ACE_Message_Block");
if (ACE_BIT_DISABLED (mb.flags_,
ACE_Message_Block::DONT_DELETE))
{
if (this->init_i (0, // size
MB_NORMAL, // type
0, // cont
0, // data
0, // allocator
0, // locking strategy
0, // flags
0, // priority
ACE_Time_Value::zero, // execution time
ACE_Time_Value::max_time, // absolute time of deadline
mb.data_block ()->duplicate (), // data block
mb.data_block ()->data_block_allocator (),
mb.message_block_allocator_) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_Message_Block")));
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
// Align ourselves
char *start = ACE_ptr_align_binary (this->base (),
align);
#else
char *start = this->base ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
// Set our rd & wr pointers
this->rd_ptr (start);
this->wr_ptr (start);
}
else
{
if (this->init_i (0, // size
MB_NORMAL, // type
0, // cont
0, // data
0, // allocator
0, // locking strategy
0, // flags
0, // priority
ACE_Time_Value::zero, // execution time
ACE_Time_Value::max_time, // absolute time of deadline
mb.data_block ()->clone_nocopy (),// data block
mb.data_block ()->data_block_allocator (),
mb.message_block_allocator_) == -1)
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("ACE_Message_Block")));
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
// Align ourselves
char *start = ACE_ptr_align_binary (this->base (),
align);
#else
char *start = this->base ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
// Set our rd & wr pointers
this->rd_ptr (start);
this->wr_ptr (start);
#if !defined (ACE_LACKS_CDR_ALIGNMENT)
// Get the alignment offset of the incoming ACE_Message_Block
start = ACE_ptr_align_binary (mb.base (),
align);
#else
start = mb.base ();
#endif /* ACE_LACKS_CDR_ALIGNMENT */
// Actual offset for the incoming message block assuming that it
// is also aligned to the same "align" byte
size_t const wr_offset = mb.wr_ptr_ - (start - mb.base ());
// Copy wr_offset amount of data in to <this->data_block>
(void) ACE_OS::memcpy (this->wr_ptr (),
start,
wr_offset);
// Dont move the write pointer, just leave it to the application
// to do what it wants
}
#if defined (ACE_LACKS_CDR_ALIGNMENT)
ACE_UNUSED_ARG (align);
#endif /* ACE_LACKS_CDR_ALIGNMENT */
}
开发者ID:Archives,项目名称:try,代码行数:93,代码来源:Message_Block.cpp
示例19: ACE_GUARD
void
CORBA::NVList::_tao_encode (TAO_OutputCDR &cdr, int flag)
{
ACE_GUARD (TAO_SYNCH_MUTEX,
ace_mon,
this->lock_);
if (this->incoming_ != 0)
{
if (this->max_ == 0)
{
// The list is empty aggressively reduce copies and just send
// the CDR stream, we assume that
// TAO_Server_Request::init_reply
// has inserted appropriated padding already to make this
// operation correct
cdr.write_octet_array_mb (this->incoming_->start ());
return;
}
// Then unmarshal each "in" and "inout" parameter.
ACE_Unbounded_Queue_Iterator<CORBA::NamedValue_ptr> i (this->values_);
for (i.first (); !i.done (); i.advance ())
{
CORBA::NamedValue_ptr *item = 0;
(void) i.next (item);
CORBA::NamedValue_ptr nv = *item;
if (ACE_BIT_DISABLED (nv->flags (), flag))
{
continue;
}
if (TAO_debug_level > 3)
{
const char* arg = nv->name ();
if (arg == 0)
{
arg = "(nil)";
}
TAOLIB_DEBUG ((LM_DEBUG,
ACE_TEXT ("NVList::_tao_encode - parameter <%C>\n"),
arg));
}
CORBA::TypeCode_ptr tc = nv->value ()->_tao_get_typecode ();
(void) TAO_Marshal_Object::perform_append (tc,
this->incoming_,
&cdr);
}
delete this->incoming_;
this->incoming_ = 0;
return;
}
// The list is already evaluated, we cannot optimize the copies, go
// ahead with the slow way to do things.
// Then marshal each "in" and "inout" parameter.
ACE_Unbounded_Queue_Iterator<CORBA::NamedValue_ptr> i (this->values_);
for (i.first (); !i.done (); i.advance ())
{
CORBA::NamedValue_ptr *item = 0;
(void) i.next (item);
CORBA::NamedValue_ptr nv = *item;
if (ACE_BIT_DISABLED (nv->flags (), flag))
{
continue;
}
nv->value ()->impl ()->marshal_value (cdr);
}
}
开发者ID:CCJY,项目名称:ATCD,代码行数:80,代码来源:NVList.cpp
示例20: ACE_TRACE
int
ACE_SOCK_Dgram_Mcast::open_i (const ACE_INET_Addr &mcast_addr,
const ACE_TCHAR *net_if,
int reuse_addr)
{
ACE_TRACE ("ACE_SOCK_Dgram_Mcast::open_i");
// ACE_SOCK::open calls this if reuse_addr is set, so we only need to
// process port reuse option.
if (reuse_addr)
{
#if defined (SO_REUSEPORT)
int one = 1;
if (this->ACE_SOCK::set_option (SOL_SOCKET,
SO_REUSEPORT,
&one,
sizeof one) == -1)
return -1;
#endif /* SO_REUSEPORT */
}
// Create an address/port# to bind the socket to. Use mcast_addr to
// initialize bind_addy to pick up the correct protocol family. If
// OPT_BINDADDR_YES is set, then we're done.
|
请发表评论