Esempio n. 1
1
void DataServer::onClientConnection(const muduo::net::TcpConnectionPtr& conn) {
    LOG_INFO << conn->peerAddress().toIpPort() << (conn->connected() ? " is UP" : " is DOWN");
}
Esempio n. 2
0
 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();
   }
 }
Esempio n. 3
0
 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();
   }
 }
Esempio n. 4
0
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);
    }
}
Esempio n. 5
0
void SudoKuServer::onConnection(const muduo::net::TcpConnectionPtr& conn)
{
    LOG_INFO<< "SudoKuServer - " << conn->peerAddress().toIpPort() << " -> "
            << conn->localAddress().toIpPort() << " is "
            << (conn->connected() ? "UP" : "DOWN");
}