예제 #1
0
void TcpConnection::connectEstablished()
{
    loop_->assertInLoopThread();
    ZL_ASSERT(state_ == kConnecting)(state_);
    setState(kConnected);
    channel_->enableReading();

    TcpConnectionPtr sp_this(shared_from_this());
    connectionCallback_(sp_this);
}
예제 #2
0
void TcpConnection::connectEstablished()
{
    LOG_INFO("TcpConnection::connectEstablished fd = %d, state = %s", socket_->fd(), getState(state_));
    loop_->assertInLoopThread();
    ZL_ASSERT(state_ == kConnecting)(state_);
    setState(kConnected);
    channel_->enableReading();

    TcpConnectionPtr sp_this(shared_from_this());
    connectionCallback_(sp_this);
}
예제 #3
0
void TcpConnection::connectDestroyed()
{
    LOG_INFO("TcpConnection::connectDestroyed fd = %d, state = %s", socket_->fd(), getState(state_));
    loop_->assertInLoopThread();
    if (state_ == kConnected)
    {
        setState(kDisconnected);
        channel_->disableAll();

        TcpConnectionPtr sp_this(shared_from_this());
        connectionCallback_(sp_this);
    }
    //SocketUtil::closeSocket(socket_->fd());
    channel_->remove();
}