|
1 windows平台:
class install_agent_srv_handle_s : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
{
ACE_Reactor_Notification_Strategy notifier_;
virtual int open(void * = 0);
virtual int handle_input(ACE_HANDLE fd = ACE_INVALID_HANDLE);
virtual int handle_output(ACE_HANDLE fd = ACE_INVALID_HANDLE);
virtual int handle_close(ACE_HANDLE h, ACE_Reactor_Mask mask);
virtual int put(ACE_Message_Block *msg, ACE_Time_Value * = 0);
}
install_agent_srv_handle_s::install_agent_srv_handle_s(void)
:notifier_ (0, this, ACE_Event_Handler::WRITE_MASK)
{
}
int install_agent_srv_handle_s::open(void * param)
{
int ret = -1;
ACE_NEW_RETURN(this->task_ ,install_task_s, ret);
if(this->task_->open() == 0)
{
if(super::open(param) == 0)
{
int bufsize = NET_BUFFER_MAX_LENGTH;
peer ().set_option (SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof bufsize);
this->reactor()->register_handler(this, ACE_Event_Handler::WRITE_MASK);
this->notifier_.reactor (this->reactor ());
this->msg_queue()->notification_strategy (&this->notifier_);
ret = 0;
}
}
else
{
this->task_->close();
this->task_ = NULL;
}
}
return ret;
}
int install_agent_srv_handle_s::put(ACE_Message_Block *msg, ACE_Time_Value * )
{
return ((this->putq(msg) > 0) ? 0 : -1);
}
int install_agent_srv_handle_s::require_down_install_file(void)
{
int ret = -1;
ACE_Message_Block *msg = new ACE_Message_Block(sizeof(INSTALL_DATA_S));
if(msg)
{
INSTALL_DATA_S *data = (INSTALL_DATA_S*)msg->wr_ptr();
data->type = INSTALL_DATA_REQUIRE;
data->cmd = INSTALL_REQUIRE_INSTALL;
data->plate_form = module_platform_version();
msg->wr_ptr(sizeof(INSTALL_DATA_S));
if((ret = put(msg) ) == -1) /* 此处每次调用并没有通知到hand_output ?????*/
{
msg->release();
}
}
return ret;
}
每次调用put接口都没有触发hand_output接口,这是为什么呢?谁知道msg notify 与reactor的调度机制?是否与waitformultipulateEvent这个接口的触发条件有关系?
此模式在linux下可以使用。
2 ace的proactor如何与ssl配合使用,就是在write和recv时也能使用? |
|