コード例 #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
ファイル: TcpConnection.cpp プロジェクト: YuuFish/zl_reactor
void TcpConnection::handleClose()
{
    loop_->assertInLoopThread();
    ZL_ASSERT(state_ == kConnected || state_ == kDisconnecting)(state_)(socket_->fd());
    setState(kDisconnected);
    channel_->disableAll();

    connectionCallback_(shared_from_this());

    closeCallback_(shared_from_this());
}
コード例 #3
0
ファイル: TcpConnection.cpp プロジェクト: YuuFish/zl_reactor
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);
}
コード例 #4
0
ファイル: TcpConnection.cpp プロジェクト: YuuFish/zl_reactor
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();
}