本文整理汇总了C++中TcpConnectionPtr::setTcpNoDelay方法的典型用法代码示例。如果您正苦于以下问题:C++ TcpConnectionPtr::setTcpNoDelay方法的具体用法?C++ TcpConnectionPtr::setTcpNoDelay怎么用?C++ TcpConnectionPtr::setTcpNoDelay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TcpConnectionPtr
的用法示例。
在下文中一共展示了TcpConnectionPtr::setTcpNoDelay方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onConnection
void onConnection(const TcpConnectionPtr& conn)
{
if (conn->connected())
{
//channel_.reset(new RpcChannel(conn));
conn->setTcpNoDelay(true);
channel_->setConnection(conn);
allConnected_->countDown();
}
}
示例2: onServerConnection
/***************************************************
Description: 处理新的TCP连接或断开
Input: 无
Output: 无
Return: 无
***************************************************/
void TCPServer::onServerConnection(const TcpConnectionPtr& conn)
{
conn->setTcpNoDelay(true);
LOG_INFO << conn->peerAddress().toIpPort() << " -> "
<< conn->localAddress().toIpPort() << " is "
<< (conn->connected() ? "UP" : "DOWN");
if(!conn->connected())
{
clearConnectionInfo(conn);
}
}
示例3: serverConnectionCallback
void serverConnectionCallback(const TcpConnectionPtr& conn)
{
LOG_TRACE << conn->name() << " " << conn->peerAddress().toIpPort() << " -> "
<< conn->localAddress().toIpPort() << " is "
<< (conn->connected() ? "UP" : "DOWN");
if (conn->connected())
{
conn->setTcpNoDelay(true);
}
else
{
}
}
示例4: clientConnectionCallback
void clientConnectionCallback(const TcpConnectionPtr& conn)
{
LOG_TRACE << conn->localAddress().toIpPort() << " -> "
<< conn->peerAddress().toIpPort() << " is "
<< (conn->connected() ? "UP" : "DOWN");
if (conn->connected())
{
clientConnection = conn;
conn->setTcpNoDelay(true);
}
else
{
clientConnection.reset();
}
}
示例5: onConnection
void onConnection(const TcpConnectionPtr& conn)
{
LOG_TRACE << conn->localAddress().toIpPort() << " -> "
<< conn->peerAddress().toIpPort() << " is "
<< (conn->connected() ? "UP" : "DOWN");
if (conn->connected())
{
conn->setTcpNoDelay(true);
conn->send(message_);
}
else
{
loop_->quit();
}
}
示例6: onServerConnection
void onServerConnection(const TcpConnectionPtr& conn)
{
LOG_DEBUG << conn->name() << (conn->connected() ? " UP" : " DOWN");
if (conn->connected())
{
conn->setTcpNoDelay(true);
TunnelPtr tunnel(new Tunnel(g_eventLoop, g_serverAddr, conn));
tunnel->setup();
tunnel->connect();
g_tunnels[conn->name()] = tunnel;
}
else
{
std::map<string, TunnelPtr>::iterator it = g_tunnels.find(conn->name());
}
}
示例7: onHBaseProxyConnection
/***************************************************
Description: 处理新的HBaseProxy连接或者连接断开情况
Input: conn:TCP连接
Output: 无
Return: 无
***************************************************/
void TCPServer::onHBaseProxyConnection(const TcpConnectionPtr &conn)
{
if(conn->connected())
{
conn->setTcpNoDelay(true);
LOG_INFO << "Connect to HBaseProxy successfully";
LocalConnections::instance()[HBase] = conn;
//发送以前发送失败的消息
for(Messages::iterator it = UnSendMessages::instance()[HBase].begin();
it != UnSendMessages::instance()[HBase].end();
++it)
{
protoCodec_.send(conn, *it);
//防止过快发送
usleep(1);
}
UnSendMessages::instance()[HBase].clear();
}
else
{
LOG_ERROR << "Lost connection to HBaseProxy";
}
}
示例8: onConnection
/*
* private functions
*
*/
void tcp_server::onConnection(const TcpConnectionPtr& conn)
{
LOG_DEBUG << "tcp_server - " << conn->peerAddress().toIpPort() << " -> " << conn->localAddress().toIpPort() << " is "
<< (conn->connected() ? "UP" : "DOWN");
if (conn->connected())
{
++numConnected_;
if (numConnected_ > kMaxConnections_)
{
conn->shutdown();
}
else
{
conn->setTcpNoDelay(true);
}
}
else
{
--numConnected_;
}
LOG_DEBUG << "numConnected = " << numConnected_;
}