本文整理汇总了C++中ObPacket::set_request方法的典型用法代码示例。如果您正苦于以下问题:C++ ObPacket::set_request方法的具体用法?C++ ObPacket::set_request怎么用?C++ ObPacket::set_request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObPacket
的用法示例。
在下文中一共展示了ObPacket::set_request方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
static int process(easy_request_t *r)
{
int ret = EASY_OK;
if (NULL == r)
{
TBSYS_LOG(WARN, "request is NULL, r = %p", r);
ret = EASY_BREAK;
}
else if (NULL == r->ipacket)
{
TBSYS_LOG(WARN, "request is NULL, r->ipacket = %p", r->ipacket);
ret = EASY_BREAK;
}
else
{
ObFileServer* server = (ObFileServer*)r->ms->c->handler->user_data;
ObPacket* packet = (ObPacket*)r->ipacket;
packet->set_request(r);
r->ms->c->pool->ref++;
easy_atomic_inc(&r->ms->pool->ref);
easy_pool_set_lock(r->ms->pool);
if (OB_REQUIRE_HEARTBEAT == packet->get_packet_code())
{
server->handle_request(packet);
}
else
{
server->handlePacket(packet);
}
ret = EASY_AGAIN;
}
return ret;
}
示例2: shadow_process
int ObTbnetCallback::shadow_process(easy_request_t* r)
{
int ret = EASY_OK;
if (NULL == r || NULL == r->ipacket)
{
TBSYS_LOG(ERROR, "request is empty, r = %p, r->ipacket = %p", r, r->ipacket);
ret = EASY_BREAK;
}
else
{
ObShadowServer *server = (ObShadowServer*)r->ms->c->handler->user_data;
ObPacket *req = (ObPacket*) r->ipacket;
req->set_request(r);
ret = server->handlePacket(req);
if (OB_SUCCESS == ret)
{
r->ms->c->pool->ref++;
easy_atomic_inc(&r->ms->pool->ref);
easy_pool_set_lock(r->ms->pool);
ret = EASY_AGAIN;
}
else
{
ret = EASY_OK;
TBSYS_LOG(WARN, "can not push packet(src is %s, pcode is %u) to packet queue",
inet_ntoa_r(r->ms->c->addr), req->get_packet_code());
}
}
return ret;
}
示例3: process
int ObProxyCallback::process(easy_request_t *r)
{
int ret = EASY_OK;
if (NULL == r)
{
TBSYS_LOG(WARN, "request is NULL, r = %p", r);
ret = EASY_BREAK;
}
else if (NULL == r->ipacket)
{
TBSYS_LOG(WARN, "request is NULL, r->ipacket = %p", r->ipacket);
ret = EASY_BREAK;
}
else
{
ObProxyServer* server = (ObProxyServer*)r->ms->c->handler->user_data;
ObPacket* packet = (ObPacket*)r->ipacket;
packet->set_request(r);
//handle_request will send response
if (OB_REQUIRE_HEARTBEAT == packet->get_packet_code())
{
server->handle_request(packet);
ret = EASY_OK;
}
else
{
ret = server->handlePacket(packet);
if (OB_SUCCESS == ret)
{
r->ms->c->pool->ref++;
easy_atomic_inc(&r->ms->pool->ref);
easy_pool_set_lock(r->ms->pool);
ret = EASY_AGAIN;
}
else
{
ret = EASY_OK;
TBSYS_LOG(WARN, "can not push packet(src is %s, pcode is %u) to packet queue",
inet_ntoa_r(r->ms->c->addr), packet->get_packet_code());
}
}
}
return ret;
}
示例4: process
int ObUpdateCallback::process(easy_request_t* r)
{
int ret = EASY_OK;
if (NULL == r)
{
TBSYS_LOG(ERROR, "request is empty, r = %p", r);
ret = EASY_BREAK;
}
else if (NULL == r->ipacket)
{
TBSYS_LOG(ERROR, "request is empty, r->ipacket = %p", r->ipacket);
ret = EASY_BREAK;
}
else
{
ObUpdateServer *server = reinterpret_cast<ObUpdateServer*>(r->ms->c->handler->user_data);
ObPacket *req = reinterpret_cast<ObPacket*>(r->ipacket);
req->set_request(r);
r->ms->c->pool->ref ++;
easy_atomic_inc(&r->ms->pool->ref);
easy_pool_set_lock(r->ms->pool);
ret = server->handlePacket(req);
if (OB_SUCCESS == ret)
{
// enqueue success
ret = EASY_AGAIN;
}
else if (OB_ENQUEUE_FAILED == ret)
{
TBSYS_LOG(WARN, "can not push packet(src is %s, pcode is %u) to packet queue",
inet_ntoa_r(r->ms->c->addr), req->get_packet_code());
r->ms->c->pool->ref --;
easy_atomic_dec(&r->ms->pool->ref);
ret = EASY_OK;
}
else /* OB_ERROR */
{
ret = EASY_AGAIN;
}
}
return ret;
}