本文整理汇总了C++中ace_asynch_read_stream::Result::act方法的典型用法代码示例。如果您正苦于以下问题:C++ Result::act方法的具体用法?C++ Result::act怎么用?C++ Result::act使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ace_asynch_read_stream::Result
的用法示例。
在下文中一共展示了Result::act方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: delete
void
JAWS_Asynch_Handler::handle_read_stream (const ACE_Asynch_Read_Stream::Result
&result)
{
JAWS_TRACE ("JAWS_Asynch_Handler::handle_read_stream");
this->dispatch_handler ();
if (result.act () != 0)
{
// This callback is for io->receive_file()
JAWS_TRACE ("JAWS_Asynch_Handler::handle_read_stream (recv_file)");
int code = 0;
if (result.success () && result.bytes_transferred () != 0)
{
if (result.message_block ().length ()
== result.message_block ().size ())
code = ACE_Filecache_Handle::ACE_SUCCESS;
else
{
ACE_Asynch_Read_Stream ar;
if (ar.open (*this, this->handler ()->handle ()) == -1
|| ar.read (result.message_block (),
result.message_block ().size ()
- result.message_block ().length (),
result.act ()) == -1)
code = -1;
else
return;
}
}
else
code = -1;
if (code == ACE_Filecache_Handle::ACE_SUCCESS)
this->handler ()->receive_file_complete ();
else
this->handler ()->receive_file_error (code);
result.message_block ().release ();
delete (ACE_Filecache_Handle *) result.act ();
}
else
{
// This callback is for this->read()
JAWS_TRACE ("JAWS_Asynch_Handler::handle_read_stream (read)");
if (result.success ()
&& result.bytes_transferred () != 0)
this->handler ()->read_complete (&result.message_block ());
else
this->handler ()->read_error ();
}
}
示例2:
void
Receiver::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result)
{
ACE_DEBUG ((LM_DEBUG,
"handle_read_stream called\n"));
// Reset pointers.
result.message_block ().rd_ptr ()[result.bytes_transferred ()] = '\0';
ACE_DEBUG ((LM_DEBUG, "********************\n"));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read ()));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ()));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered", result.bytes_transferred ()));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (uintptr_t) result.act ()));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ()));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (uintptr_t) result.completion_key ()));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ()));
ACE_DEBUG ((LM_DEBUG, "********************\n"));
#if 0
// This can overrun the ACE_Log_Msg buffer and do bad things.
// Re-enable it at your risk.
ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ()));
#endif /* 0 */
if (result.success () && result.bytes_transferred () != 0)
{
// Successful read: write the data to the file asynchronously.
// Note how we reuse the <ACE_Message_Block> for the writing.
// Therefore, we do not delete this buffer because it is handled
// in <handle_write_stream>.
if (this->wf_.write (result.message_block (),
result.bytes_transferred (),
this->file_offset_) == -1)
{
ACE_ERROR ((LM_ERROR,
"%p\n",
"ACE_Asynch_Write_File::write"));
return;
}
// Initiate new read from the stream.
if (this->initiate_read_stream () == -1)
return;
}
else
{
ACE_DEBUG ((LM_DEBUG,
"Receiver completed\n"));
// No need for this message block anymore.
result.message_block ().release ();
// Note that we are done with the test.
done = 1;
// We are done: commit suicide.
delete this;
}
}
示例3: locker
void
Receiver::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result)
{
ACE_DEBUG ((LM_DEBUG,
"handle_read_stream called\n"));
// Reset pointers.
result.message_block ().rd_ptr ()[result.bytes_transferred ()] =
'\0';
ACE_DEBUG ((LM_DEBUG, "********************\n"));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_read", result.bytes_to_read
()));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "handle", result.handle ()));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_transfered",
result.bytes_transferred ()));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "act", (u_long) result.act ()));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "success", result.success ()));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "completion_key", (u_long)
result.completion_key ()));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "error", result.error ()));
ACE_DEBUG ((LM_DEBUG, "********************\n"));
ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block",
result.message_block ().rd_ptr ()));
if ( result.success () && result.bytes_transferred () != 0)
{
// Successful read: write the data to the file asynchronously.
// Note how we reuse the <ACE_Message_Block> for the writing.
// Therefore, we do not delete this buffer because it is handled
// in <handle_write_stream>.
if(this->initiate_write_stream (result.message_block (),
result.bytes_transferred () ) == 0 )
{
if ( duplex != 0 )
{
// Initiate new read from the stream.
this->initiate_read_stream () ;
}
}
}
else
{
result.message_block ().release ();
ACE_DEBUG ((LM_DEBUG, "Receiver completed\n"));
}
{
ACE_Guard<MyMutex> locker (m_Mtx) ;
nIOCount-- ;
}
check_destroy () ;
}
示例4:
void
JAWS_EC_AH_Adapter
::handle_read_stream (const ACE_Asynch_Read_Stream::Result &result)
{
JAWS_Event_Result io_result;
io_result = this->make_io_result ( result
, JAWS_Event_Result::JE_RECV_OK
, JAWS_Event_Result::JE_RECV_FAIL
);
// More useful diagnostics not implemented yet.
void *act = const_cast<void *> (result.act ());
this->completer_->input_complete (io_result, act);
delete this;
}