本文整理汇总了C++中ace_asynch_write_stream::Result类的典型用法代码示例。如果您正苦于以下问题:C++ Result类的具体用法?C++ Result怎么用?C++ Result使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Result类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: handle_write_stream
void CProConsoleHandle::handle_write_stream(const ACE_Asynch_Write_Stream::Result &result)
{
if(!result.success() || result.bytes_transferred()==0)
{
//链接断开
OUR_DEBUG ((LM_DEBUG,"[CConnectHandler::handle_write_stream] Connectid=[%d] begin(%d)...\n",GetConnectID(), errno));
//AppLogManager::instance()->WriteLog(LOG_SYSTEM_CONNECT, "Close Connection from [%s:%d] RecvSize = %d, RecvCount = %d, SendSize = %d, SendCount = %d.",m_addrRemote.get_host_addr(), m_addrRemote.get_port_number(), m_u4AllRecvSize, m_u4AllRecvCount, m_u4AllSendSize, m_u4AllSendCount);
OUR_DEBUG((LM_DEBUG,"[CConnectHandler::handle_write_stream] Connectid=[%d] finish ok...\n", GetConnectID()));
m_atvOutput = ACE_OS::gettimeofday();
App_MessageBlockManager::instance()->Close(&result.message_block());
Close();
return;
}
else
{
//短读不考虑
m_blCanWrite = true;
m_atvOutput = ACE_OS::gettimeofday();
App_MessageBlockManager::instance()->Close(&result.message_block());
m_u4AllSendSize += (uint32)result.bytes_to_write();
Close();
return;
}
}
开发者ID:burstas,项目名称:purenessscopeserver,代码行数:26,代码来源:ProConsoleHandle.cpp
示例2:
void
Sender::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
{
this->trace_write_completion (result);
{
ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->mutex ());
this->ref_cnt_w_--;
ACE_Message_Block & mb = result.message_block ();
mb.release ();
if (result.error () != 0 ||
result.bytes_transferred () == 0 ||
this->initiate_write_stream () != 0 ||
this->initiate_read_stream() != 0)
{
this->cancel_i ();
}
if (!this->is_safe_to_delete())
return;
}
this->manager()->destroy_session(this);
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:27,代码来源:PSSL_Test.cpp
示例3:
void
JAWS_Asynch_IO::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
{
result.message_block ().release ();
if (result.act () == (void *) CONFORMATION)
this->handler_->confirmation_message_complete ();
else
this->handler_->error_message_complete ();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:10,代码来源:JAWS_IO.cpp
示例4: handle_write_stream
virtual void handle_write_stream(const ACE_Asynch_Write_Stream::Result &result)
{
//trace_msg("handle output.");
result.message_block().release();
if (result.success() == false)
{
_peer.emit(kSignalClosed);
}
}
开发者ID:imace,项目名称:nnt,代码行数:10,代码来源:SocketClient.cpp
示例5:
void
Peer_Handler::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
{
if (result.bytes_transferred () <= 0)
ACE_DEBUG ((LM_DEBUG, "(%t) %p bytes = %d\n", "Message failed",
result.bytes_transferred ()));
// This was allocated by the STDIN_Handler, queued, dequeued, passed
// to the proactor, and now passed back to us.
result.message_block ().release ();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:11,代码来源:Talker.cpp
示例6:
void
Client_Handler::handle_write_stream
(const ACE_Asynch_Write_Stream::Result &result)
{
if (!result.success ())
{
errno = result.error ();
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("(%t) Client handle %d: %p\n"),
this->stream_.handle (),
ACE_TEXT ("write")));
delete this;
return;
}
ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) Client %@ handle %d sent %B of %B bytes\n"),
this, this->stream_.handle (),
result.bytes_transferred (), result.bytes_to_write ()));
ACE_Message_Block &b = result.message_block ();
bool send_again = true;
if (b.length () == 0)
{
// All block's data sent; rewind the read pointer and send it again
// until we've sent the configured number of times.
++this->msgs_sent_;
if (this->msgs_sent_ == cli_req_no)
send_again = false; // All done
else
b.rd_ptr (b.base ());
}
if (send_again)
{
if (this->stream_.write (this->block_, this->block_.length ()) == -1)
{
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("(%t) Client_Handler: %p\n"),
ACE_TEXT ("initiate write")));
delete this;
}
}
else
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) Client handle %d done sending\n"),
this->stream_.handle ()));
delete this;
}
return;
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:49,代码来源:SSL_Asynch_Stream_Test.cpp
示例7: if
void
PConnection::trace_write_completion (const ACE_Asynch_Write_Stream::Result &result)
{
int loglevel = this->config().loglevel ();
size_t xfer_bytes = result.bytes_transferred();
if (loglevel == 0)
{
LogLocker log_lock;
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) **** %s=%d handle_write_stream() ****\n"),
this->get_name(),
this->index()));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("bytes_to_write = %d\n"),
result.bytes_to_write ()));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("handle = %d\n"),
result.handle ()));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("bytes_transfered = %d\n"),
xfer_bytes));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("error = %d\n"),
result.error ()));
trace_buffers (result.get_buffer_info (), xfer_bytes, false);
}
else if (result.error () != 0 )
{
LogLocker log_lock;
ACE_Log_Msg::instance ()->errnum (result.error ());
ACE_OS::last_error (result.error ());
ACE_Log_Msg::instance ()->log (LM_ERROR,
ACE_TEXT ("(%t) %s=%d WRITE %p\n"),
this->get_name (),
this->index (),
ACE_TEXT ("ERROR"));
}
else if (loglevel == 1)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) %s=%d write_bytes=%d OK\n"),
this->get_name (),
this->index (),
xfer_bytes));
}
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:56,代码来源:PConnection.cpp
示例8: if
void AIO_Output_Handler::handle_write_stream
(const ACE_Asynch_Write_Stream::Result &result) {
ACE_Message_Block &mblk = result.message_block ();
if (!result.success ()) {
mblk.rd_ptr (mblk.base ());
ungetq (&mblk);
}
else {
can_write_ = handle () == result.handle ();
if (mblk.length () == 0) {
mblk.release ();
if (can_write_) start_write ();
}
else if (can_write_) start_write (&mblk);
else { mblk.rd_ptr (mblk.base ()); ungetq (&mblk); }
}
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:17,代码来源:AIO_Client_Logging_Daemon.cpp
示例9: if
// ************************************************************
// Internal IO handlers
// virtual from ACE_Service_Handler
// ************************************************************
void
ACE_SSL_Asynch_Stream::handle_write_stream (
const ACE_Asynch_Write_Stream::Result &result)
{
ACE_MT (ACE_GUARD (ACE_SYNCH_MUTEX, ace_mon, this->mutex_));
this->bio_out_flag_ &= ~BF_AIO;
ACE_Message_Block & mb = result.message_block ();
size_t bytes_req = result.bytes_to_write ();
size_t bytes_trn = result.bytes_transferred ();
u_long errval = result.error ();
size_t len = bytes_req - bytes_trn;
if (errval != 0) // error ?
this->bio_out_errno_ = errval; // save err code
else if (len > 0) // TCP/IP overloaded ?
{ // continue, rd_ptr at right place
if (this->bio_ostream_.write (
mb, // message block
len, // priority
0, // act
0, // priority
ACE_SIGRTMIN // default signal
) == 0)
{
this->bio_out_flag_ |= BF_AIO;
return;
}
ACELIB_ERROR
((LM_ERROR,
ACE_TEXT ("(%P|%t) ACE_SSL_Asynch_Stream %p\n"),
ACE_TEXT ("attempt write failed")
));
this->bio_out_errno_ = EINVAL;
}
this->do_SSL_state_machine ();
return;
}
开发者ID:binary42,项目名称:OCI,代码行数:48,代码来源:SSL_Asynch_Stream.cpp
示例10:
void
PConnection::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
{
this->trace_write_completion (result);
{
ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->mutex ());
this->update_last_time();
this->ref_cnt_w_--;
ACE_Message_Block & mb = result.message_block ();
int error = result.error();
size_t xfer_bytes = result.bytes_transferred ();
size_t req_bytes = result.bytes_to_write ();
// done in initiate_write_stream
// !!!! this->total_snd_ += xfer_bytes;
if (error == 0 && this->protocol_ != 0)
{
if (xfer_bytes < req_bytes) // Process partial write
{
this->do_initiate_write_stream (mb);
}
else
{
check_out_queue ();
this->protocol_->on_write_finished (mb, xfer_bytes, error);
}
}
else
{
this->free_msg (&mb);
this->cancel ();
}
if (!is_safe_to_delete())
return;
}
this->manager()->destroy_connection(this);
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:43,代码来源:PConnection.cpp
示例11:
void
Sender::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
{
ACE_Message_Block *mb = &result.message_block ();
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Sender::handle_write_stream - wrote %d bytes\n"),
result.bytes_transferred ()));
if (result.error () == 0 && result.bytes_transferred () != 0)
// verify sent all
ACE_TEST_ASSERT (0 == mb->total_length ());
else
ACE_TEST_ASSERT (0);
free_chunks_chain (mb);
--this->io_count_;
this->check_destroy ();
}
开发者ID:CCJY,项目名称:ACE,代码行数:21,代码来源:Proactor_Scatter_Gather_Test.cpp
示例12: handle_write_stream
void CProConnectClient::handle_write_stream(const ACE_Asynch_Write_Stream::Result &result)
{
ACE_Message_Block& mblk = result.message_block();
if(!result.success() || result.bytes_transferred() == 0)
{
//处理数据发送出错
OUR_DEBUG((LM_DEBUG, "[CProConnectClient::handle_write_stream]Write error(%d).\n", ACE_OS::last_error()));
mblk.release();
if(NULL != m_pClientMessage)
{
_ClientIPInfo objServerIPInfo;
sprintf_safe(objServerIPInfo.m_szClientIP, MAX_BUFF_20, "%s", m_AddrRemote.get_host_addr());
objServerIPInfo.m_nPort = m_AddrRemote.get_port_number();
m_pClientMessage->ConnectError((int)ACE_OS::last_error(), objServerIPInfo);
}
Close();
}
else
{
mblk.release();
}
}
开发者ID:ACEZLY,项目名称:PSS,代码行数:22,代码来源:ProConnectClient.cpp
示例13: locker
void
Receiver::handle_write_stream (const ACE_Asynch_Write_Stream::Result
&result)
{
ACE_DEBUG ((LM_DEBUG, "handle_write_stream called\n"));
ACE_DEBUG ((LM_DEBUG, "********************\n"));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write",
result.bytes_to_write ()));
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"));
result.message_block ().release ();
if (result.success ())
{
// This code is not robust enough to deal with short file writes
// (which hardly ever happen) ;-)
//ACE_ASSERT (result.bytes_to_write () == result.bytes_transferred ());
if ( duplex == 0 )
{
initiate_read_stream () ;
}
}
{
ACE_Guard<MyMutex> locker (m_Mtx) ;
nIOCount-- ;
}
check_destroy () ;
}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:39,代码来源:test_proactor2.cpp
示例14:
void
JAWS_EC_AH_Adapter
::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
{
JAWS_Event_Result io_result;
io_result = this->make_io_result ( result
, JAWS_Event_Result::JE_SEND_OK
, JAWS_Event_Result::JE_SEND_FAIL
);
// More useful diagnostics not implemented yet.
void *act = const_cast<void *> (result.act ());
this->completer_->output_complete (io_result, act);
delete this;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:17,代码来源:Asynch_IO.cpp
示例15: handle_write_stream
void Sender::handle_write_stream (const ACE_Asynch_Write_Stream::Result
&result)
{
ACE_DEBUG ((LM_DEBUG,
"handle_write_stream called\n"));
// Reset pointers.
result.message_block ().rd_ptr (result.message_block ().rd_ptr () -
result.bytes_transferred ());
ACE_DEBUG ((LM_DEBUG, "********************\n"));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write",
result.bytes_to_write ()));
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 ()));
// Simplify just for Test
if (result.success () && result.bytes_transferred () != 0)
{
if ( duplex != 0 ) // full duplex, continue write
{
initiate_write_stream () ;
}
else // half-duplex read reply, after read we will start
// write
{
initiate_read_stream () ;
}
}
{
ACE_Guard<MyMutex> locker (m_Mtx) ;
nIOCount-- ;
}
}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:45,代码来源:test_proactor2.cpp
示例16: handle_write_stream
void ProactorService::handle_write_stream( const ACE_Asynch_Write_Stream::Result& result )
{
result.message_block().release();
}
开发者ID:codemaru,项目名称:CGSF,代码行数:4,代码来源:ProactorService.cpp
示例17: if
void
Sender::handle_write_stream (const ACE_Asynch_Write_Stream::Result &result)
{
ACE_DEBUG ((LM_DEBUG,
"handle_write_stream called\n"));
// Reset pointers.
result.message_block ().rd_ptr (result.message_block ().rd_ptr () - result.bytes_transferred ());
ACE_DEBUG ((LM_DEBUG, "********************\n"));
ACE_DEBUG ((LM_DEBUG, "%s = %d\n", "bytes_to_write", result.bytes_to_write ()));
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
ACE_DEBUG ((LM_DEBUG, "%s = %s\n", "message_block", result.message_block ().rd_ptr ()));
#endif
if (result.success ())
{
// Partial write to socket
int unsent_data =
ACE_Utils::truncate_cast<int> (
result.bytes_to_write () - result.bytes_transferred ());
if (unsent_data != 0)
{
// Reset pointers
result.message_block ().rd_ptr (result.bytes_transferred ());
// Duplicate the message block and retry remaining data
if (this->ws_.write (*result.message_block ().duplicate (),
unsent_data) == -1)
{
ACE_ERROR ((LM_ERROR,
"%p\n",
"ACE_Asynch_Write_Stream::write"));
return;
}
}
else if (!(this->file_size_ > this->file_offset_))
{
this->stream_write_done_ = 1;
if (this->transmit_file_done_)
done = 1;
}
}
// Release message block.
result.message_block ().release ();
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:55,代码来源:test_proactor.cpp
示例18: if
void
PSession::trace_write_completion (const ACE_Asynch_Write_Stream::Result &result)
{
{
ACE_GUARD (ACE_SYNCH_MUTEX, monitor, this->mutex ());
this->update_last_time();
if (result.success())
this->total_snd_ += result.bytes_transferred ();
}
int loglevel = this->config().loglevel ();
ACE_Message_Block & mb = result.message_block ();
size_t xfer_bytes = result.bytes_transferred();
char * last = mb.rd_ptr();
char * first = last - xfer_bytes;
if (loglevel == 0)
{
LogLocker log_lock;
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) **** %s=%d handle_write_stream() ****\n"),
this->get_name(),
this->index()));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("bytes_to_write = %d\n"),
result.bytes_to_write ()));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("handle = %d\n"),
result.handle ()));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("bytes_transfered = %d\n"),
xfer_bytes));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("error = %d\n"),
result.error ()));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("message_block:\n")));
ACE_HEX_DUMP ((LM_DEBUG, first, xfer_bytes));
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("**** end of message ****************\n")));
}
else if (result.error () != 0 )
{
LogLocker log_lock;
ACE_Log_Msg::instance ()->errnum (result.error ());
ACE_OS::last_error (result.error ());
ACE_Log_Msg::instance ()->log (LM_ERROR,
ACE_TEXT ("(%t) %s=%d WRITE %p\n"),
this->get_name (),
this->index (),
ACE_TEXT ("ERROR"));
}
else if (loglevel == 1)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("(%t) %s=%d write_bytes=%d OK\n"),
this->get_name (),
this->index (),
xfer_bytes));
}
return;
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:76,代码来源:PSession.cpp
示例19: handle_write_stream
void HttpdPeer::handle_write_stream( const ACE_Asynch_Write_Stream::Result &result )
{
ACE_Message_Block& mb=result.message_block();
size_t unsent_data;
if (result.success())
{
unsent_data = result.bytes_to_write() - result.bytes_transferred();
if (unsent_data != 0) //未写完
{
// Reset pointers
result.message_block ().rd_ptr (result.bytes_transferred ());
// Duplicate the message block and retry remaining data
if (writer_.write (*result.message_block ().duplicate (),
unsent_data) == -1)
{
ACE_ERROR ((LM_ERROR,
"%p ",
"HttpPeer::Write"));
ACE_OS::printf("%d\n",ACE_OS::last_error());
result.message_block().release();
return;
}
result.message_block().release();
}
else
{
ACE_Guard<ACE_Thread_Mutex> guard(mutex_);
mb.release();
if (bIsIniting_)
{
if (!delivered_header_ && lpMgr->mhdr_.len_>0)
{
//Push Header
ACE_Message_Block *lpMb = NULL;
ACE_NEW_NORETURN(lpMb,ACE_Message_Block(lpMgr->mhdr_.data_,lpMgr->mhdr_.len_));
lpMb->wr_ptr(lpMgr->mhdr_.len_);
putQ(lpMb);
//ACE_Time_Value tv;
//tv.msec(300);//
//ACE_OS::sleep(tv);
delivered_header_ = true;
}
else
{
sentinel_ = lpMgr->buffer_.start_seg_id_;
while(lpMgr->buffer_.get_data(sentinel_)!= NULL)
{
ACE_Message_Block *mb_ = lpMgr->buffer_.get_data(sentinel_);
if (mb_!=NULL)
{
mq_.push_back(mb_->duplicate());
}
sentinel_++;
}
bIsIniting_ = false;
}
}
init_write();
}
}
}
开发者ID:yuanxu,项目名称:liveshow_r2,代码行数:75,代码来源:HttpdPeer.cpp
示例20: handle_write_dgram
void Reciever::handle_write_dgram(const ACE_Asynch_Write_Stream::Result &result)
{
ACE_Message_Block &mb = result.message_block ();
mb.release();
return;
}
开发者ID:wudippda,项目名称:ACE_Server,代码行数:6,代码来源:Reciever.cpp
注:本文中的ace_asynch_write_stream::Result类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论