void DataServer::onClientConnection(const muduo::net::TcpConnectionPtr& conn) {
    LOG_INFO << conn->peerAddress().toIpPort() << (conn->connected() ? " is UP" : " is DOWN");
}
 void onConnection(const muduo::net::TcpConnectionPtr& conn) {
   if(conn->connected()) {
     conn_ = conn;
     sendRequest(14, false);
   }
   else {
     LOG_INFO << conn->peerAddress().toIpPort() << " is down";
     conn->shutdown();
   }
 }
 void onConnection(const muduo::net::TcpConnectionPtr& conn) {
   if(conn->connected()) {
     LOG_INFO << "connect to " << conn->peerAddress().toIpPort();
     conn->setTcpNoDelay(true);
     conn->send("ready\r\n");
   }
   else {
     LOG_INFO << conn->peerAddress().toIpPort() << " is down";
     client.disconnect();
   }
 }
void DataServer::onWorkerConnection(const muduo::net::TcpConnectionPtr& conn) {
    std::string peer(conn->peerAddress().toIpPort().c_str());
    if(conn->connected()) {
        LOG_INFO << "connected to worker: " << peer;
        connections.insert(std::make_pair(peer, conn));

        {
            std::unique_lock<std::mutex> lock(mt);
            size -= 1;
            cond.notify_all();
        }
    }
    else {
        LOG_INFO << "worker: " << peer << " is down";
        workers.erase(peer);
        connections.erase(peer);
    }
}
Beispiel #5
0
void SudoKuServer::onConnection(const muduo::net::TcpConnectionPtr& conn)
{
    LOG_INFO<< "SudoKuServer - " << conn->peerAddress().toIpPort() << " -> "
            << conn->localAddress().toIpPort() << " is "
            << (conn->connected() ? "UP" : "DOWN");
}