コード例 #1
0
void
AIO_SSL_Client_Session::handle_read_stream(const TRB_Asynch_Read_Stream::Result& result)
{
	if ( ssl_ )
	{
		{
			ACE_GUARD(ACE_SYNCH_MUTEX, monitor, this->lock_);

			--n_op_r_;

			ACE_Message_Block& mb = result.message_block();

			// on read done
			if ( result.error() == 0 )
			{
				update_last_time();
				if ( result.bytes_transferred() == 0 )
				{
					mb.release(); ssl_stream_.close();
				}
				else
				{
					int rc = this->on_read_complete(mb, result);
					if ( rc < 1 ) 
					{
						mb.release();
						if ( rc < 0 && !is_cancelling_ ) { is_cancelling_ = 1; ssl_stream_.cancel(); }
					}
				}
			}
			// on read error, close session
			else
			{
				mb.release();
				if ( !is_cancelling_ ) { is_cancelling_ = 1; ssl_stream_.cancel(); }
			}
			
			if ( this->has_pending_io() ) return;
			if ( this->is_safe_to_delete_ == 0 ) { ssl_stream_.close(); return; }
			this->on_close();
		}
		
		manager_->destroy_session(this);
	}
	else
	{
		AIO_Session::handle_read_stream(result);
	}
}
コード例 #2
0
ファイル: server_collect.cpp プロジェクト: ailyanlu/tfs
 void ServerCollect::update(const common::DataServerStatInfo& info, const time_t now, const bool is_new)
 {
   id_ = info.id_;
   use_capacity_ = info.use_capacity_;
   total_capacity_ = info.total_capacity_;
   current_load_ = info.current_load_;
   block_count_ = info.block_count_;
   update_last_time(!is_new ? now : (now + common::SYSPARAM_NAMESERVER.heart_interval_ * MULTIPLE));
   startup_time_ = is_new ? now : info.startup_time_;
   status_ = info.status_;
   read_count_ = info.total_tp_.read_file_count_;
   read_byte_ = info.total_tp_.read_byte_;
   write_count_ = info.total_tp_.write_file_count_;
   write_byte_ = info.total_tp_.write_byte_;
 }