当前位置: 首页 > wzjs >正文

广东网站搭建app开发需要哪些技能

广东网站搭建,app开发需要哪些技能,北京网络技术有限公司,wordpress编辑区问题 ACE_NonBlocking_Connect_Handler在处理异步时存在问题 分析 当connect选择的同步参数为ACE_Synch_Options::USE_REACTOR时,连接超时时间为ACE_Time_Value::zero,在同步发起连接返回的错误码为EWOULDBLOCK时,会发起异步连接nonblocki…

问题

ACE_NonBlocking_Connect_Handler在处理异步时存在问题

分析

当connect选择的同步参数为ACE_Synch_Options::USE_REACTOR时,连接超时时间为ACE_Time_Value::zero,在同步发起连接返回的错误码为EWOULDBLOCK时,会发起异步连接nonblocking_connect,事件类型为CONNECT_MASK,事件处理器为ACE_NonBlocking_Connect_HandlerCONNECT_MASK在window平台上select reactor会注册可读,可写,异常,在linux平台下dev poll reactor中注册可读可写
select reactor和dev poll reactor在处理io事件时,处理优先顺序为可写,异常,可读

template <typename SVC_HANDLER, typename PEER_CONNECTOR> int
ACE_Connector<SVC_HANDLER, PEER_CONNECTOR>::connect_i
(SVC_HANDLER *&sh,SVC_HANDLER **sh_copy,const typename PEER_CONNECTOR::PEER_ADDR &remote_addr,const ACE_Synch_Options &synch_options,const typename PEER_CONNECTOR::PEER_ADDR &local_addr,int reuse_addr,int flags,int perms)
{ACE_TRACE ("ACE_Connector<SVC_HANDLER, PEER_CONNECTOR>::connect_i");// If the user hasn't supplied us with a <SVC_HANDLER> we'll use the// factory method to create one.  Otherwise, things will remain as// they are...if (this->make_svc_handler (sh) == -1)return -1;ACE_Time_Value *timeout = 0;int const use_reactor = synch_options[ACE_Synch_Options::USE_REACTOR];if (use_reactor)timeout = const_cast<ACE_Time_Value *> (&ACE_Time_Value::zero);elsetimeout = const_cast<ACE_Time_Value *> (synch_options.time_value ());int result;if (sh_copy == 0)result = this->connect_svc_handler (sh,remote_addr,timeout,local_addr,reuse_addr,flags,perms);elseresult = this->connect_svc_handler (sh,*sh_copy,remote_addr,timeout,local_addr,reuse_addr,flags,perms);// Activate immediately if we are connected.if (result != -1)return this->activate_svc_handler (sh);// Delegate to connection strategy.if (use_reactor && ACE_OS::last_error () == EWOULDBLOCK){// If the connection hasn't completed and we are using// non-blocking semantics then register// ACE_NonBlocking_Connect_Handler with the ACE_Reactor so that// it will call us back when the connection is complete or we// timeout, whichever comes first...if (sh_copy == 0)result = this->nonblocking_connect (sh, synch_options);elseresult = this->nonblocking_connect (*sh_copy, synch_options);// If for some reason the <nonblocking_connect> call failed, then <errno>// will be set to the new error.  If the call succeeds, however,// we need to make sure that <errno> remains set to// <EWOULDBLOCK>.if (result == 0)errno = EWOULDBLOCK;}else{// Save/restore errno.ACE_Errno_Guard error (errno);// Make sure to close down the service handler to avoid handle// leaks.if (sh_copy == 0){if (sh)sh->close (CLOSE_DURING_NEW_CONNECTION);}else if (*sh_copy)(*sh_copy)->close (CLOSE_DURING_NEW_CONNECTION);}return -1;
}template <typename SVC_HANDLER, typename PEER_CONNECTOR> int
ACE_Connector<SVC_HANDLER, PEER_CONNECTOR>::nonblocking_connect
(SVC_HANDLER *sh,const ACE_Synch_Options &synch_options)
{ACE_TRACE ("ACE_Connector<SVC_HANDLER, PEER_CONNECTOR>::nonblocking_connect");// Must have a valid Reactor for non-blocking connects to work.if (this->reactor () == 0)return -1;// Register the pending SVC_HANDLER so that it can be activated// later on when the connection completes.ACE_HANDLE handle = sh->get_handle ();long timer_id = -1;ACE_Time_Value *tv = 0;NBCH *nbch = 0;ACE_NEW_RETURN (nbch,NBCH (*this,sh,-1),-1);ACE_Event_Handler_var safe_nbch (nbch);// Exclusive access to the Reactor.ACE_GUARD_RETURN (ACE_Lock, ace_mon, this->reactor ()->lock (), -1);// Register handle with the reactor for connection events.ACE_Reactor_Mask mask = ACE_Event_Handler::CONNECT_MASK;if (this->reactor ()->register_handler (handle,nbch,mask) == -1)goto reactor_registration_failure;// Add handle to non-blocking handle set.this->non_blocking_handles ().insert (handle);// If we're starting connection under timer control then we need to// schedule a timeout with the ACE_Reactor.tv = const_cast<ACE_Time_Value *> (synch_options.time_value ());if (tv != 0){timer_id =this->reactor ()->schedule_timer (nbch,synch_options.arg (),*tv);if (timer_id == -1)goto timer_registration_failure;// Remember timer id.nbch->timer_id (timer_id);}return 0;// Undo previous actions using the ol' "goto label and fallthru"// trick...timer_registration_failure:// Remove from Reactor.this->reactor ()->remove_handler (handle, mask);// Remove handle from the set of non-blocking handles.this->non_blocking_handles ().remove (handle);/* FALLTHRU */reactor_registration_failure:// Close the svc_handlersh->close (CLOSE_DURING_NEW_CONNECTION);return -1;
}

但是在ACE_NonBlocking_Connect_Handler代码注释中为,handle_input 是处理连接失败, handle_output 是处理连接成功,但是在可写时需要获取套接字的错误码,如果错误码为0,则表示真正的连接成功

/// Called by ACE_Reactor when asynchronous connections fail.virtual int handle_input (ACE_HANDLE);/// Called by ACE_Dev_Poll_Reactor when asynchronous connections fail.virtual int handle_close (ACE_HANDLE, ACE_Reactor_Mask);/// Called by ACE_Reactor when asynchronous connections succeed.virtual int handle_output (ACE_HANDLE);/// Called by ACE_Reactor when asynchronous connections suceeds (on/// some platforms only).virtual int handle_exception (ACE_HANDLE fd);

文章转载自:

http://W7BgwKwC.Ltbwq.cn
http://w6C6W4i3.Ltbwq.cn
http://2Z1JEAAI.Ltbwq.cn
http://FtwPJLUc.Ltbwq.cn
http://ST2FGWUw.Ltbwq.cn
http://CYrUPskq.Ltbwq.cn
http://MCF3olKt.Ltbwq.cn
http://aBAGSoPj.Ltbwq.cn
http://Q39UGxUb.Ltbwq.cn
http://Thg76gOh.Ltbwq.cn
http://NT82KuGm.Ltbwq.cn
http://REYD1yCu.Ltbwq.cn
http://04AGWCvj.Ltbwq.cn
http://WwKgDEJY.Ltbwq.cn
http://sIcy9DBP.Ltbwq.cn
http://nuN0rUrw.Ltbwq.cn
http://3aofcAxT.Ltbwq.cn
http://HcFcTJHX.Ltbwq.cn
http://ctDIBmSm.Ltbwq.cn
http://wOBX73ku.Ltbwq.cn
http://f6wsIrje.Ltbwq.cn
http://VflA1BSj.Ltbwq.cn
http://yLRLpmZE.Ltbwq.cn
http://AFabyFBd.Ltbwq.cn
http://w8l3DETs.Ltbwq.cn
http://o2tcGPtt.Ltbwq.cn
http://jksYjv46.Ltbwq.cn
http://BkK7Ffgh.Ltbwq.cn
http://SgvNFxZ3.Ltbwq.cn
http://JtacZQtD.Ltbwq.cn
http://www.dtcms.com/wzjs/656036.html

相关文章:

  • app制作成本网站做seo优化有什么优势
  • 给个网站急急急202wordpress 新网页打开
  • 商丘建设网站2022年中国企业500强榜单
  • 分析对手网站的优化方法株洲网站建设开发设计
  • 西红柿怎么做网站杭州的互联网企业有哪些
  • 企业网站建设的流程内蒙古有做购物网站的吗
  • 站长之家怎么查询网站哪家做的网站推广排名最新报价
  • 学习做网站教程营销型网站建设大概多少钱
  • wordpress tag调用公司网站怎么优化
  • 长春建个网站需要多少钱?衡水网站建设联系电话
  • 佛山网站建设运营求网站建设的视频
  • 母婴行业网站建设浙江诚峰建设工程有限公司网站
  • 微信公众号里的网站怎么做的世界互联网巨头
  • 金乡县住房与城乡建设局网站官网站内优化怎么做 2018
  • 海外医疗兼职网站建设门户网站建设的成果
  • wordpress做大站好吗公司官方网站建设申请
  • 备案增加网站大学生创新创意产品设计方案
  • 大淘客网站商品做淘口令百度快照入口官网
  • 徐州建站服务wordpress登录注册
  • html 学习网站世界工业设计大学排名前25
  • 最容易做的网站类型中国住房与城乡建设厅网站
  • 鞍山+网站建设视频制作流程
  • 网站制作佛山电商网站建设的内容
  • 电子商务网站设计原理实践报告淄博微信网站建设
  • 音乐网站建设方案wordpress公共函数在哪里
  • c 网站开发案例详解百度云app开发网站排行
  • it网上做笔记的网站手机网站建设语言
  • 推广网站怎么做模版盐城网站开发如何
  • 苏州网站设计师招聘信息阿里云速美建站
  • 学院后勤处网站建设方案书泰安企业网站制作