// File: guoxuanhan[P]NetServer/tcpconnection.cpp
// Function: TcpConnection::TcpConnection(EventLoop*, int, sockaddr_in const&)
TcpConnection::TcpConnection(EventLoop *loop, int fd, const struct sockaddr_in &clientaddr)
    : loop_(loop),
    spchannel_(new Channel()),
    fd_(fd),
    clientaddr_(clientaddr),
    halfclose_(false),
    disconnected_(false),
    asyncprocessing_(false),
    bufferin_(),
    bufferout_()
{
    //注册事件执行函数
    spchannel_->SetFd(fd_);
    spchannel_->SetEvents(EPOLLIN | EPOLLET);
    spchannel_->SetReadHandle(std::bind(&TcpConnection::HandleRead, this));
    spchannel_->SetWriteHandle(std::bind(&TcpConnection::HandleWrite, this));
    spchannel_->SetCloseHandle(std::bind(&TcpConnection::HandleClose, this));
    spchannel_->SetErrorHandle(std::bind(&TcpConnection::HandleError, this));
}

// Assembly:
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rdi, 0x1e0(%rsp)
movq %rsi, 0x1d8(%rsp)
movl %edx, 0x1d4(%rsp)
movq %rcx, 0x1c8(%rsp)
movq 0x1e0(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x1d310
movq 0x60(%rsp), %rax
movq 0x1d8(%rsp), %rcx
movq %rcx, 0x10(%rax)
addq $0x18, %rax
movq %rax, 0x68(%rsp)
movl $0x88, %edi
callq 0x53c0
movq %rax, 0x70(%rsp)
jmp 0x1bdb3
movq 0x70(%rsp), %rdi
callq 0x5bc0
jmp 0x1bdbf
movq 0x70(%rsp), %rsi
movq 0x68(%rsp), %rdi
callq 0x1d320
movq 0x60(%rsp), %rdi
movl 0x1d4(%rsp), %eax
movl %eax, 0x20(%rdi)
movq 0x1c8(%rsp), %rax
movups (%rax), %xmm0
movups %xmm0, 0x24(%rdi)
movb $0x0, 0x34(%rdi)
movb $0x0, 0x35(%rdi)
movb $0x0, 0x36(%rdi)
addq $0x38, %rdi
movq %rdi, 0x28(%rsp)
callq 0x54f0
movq 0x60(%rsp), %rdi
addq $0x58, %rdi
movq %rdi, 0x30(%rsp)
callq 0x54f0
movq 0x60(%rsp), %rdi
addq $0x78, %rdi
movq %rdi, 0x38(%rsp)
callq 0x1d350
movq 0x60(%rsp), %rdi
addq $0x98, %rdi
movq %rdi, 0x40(%rsp)
callq 0x1d390
movq 0x60(%rsp), %rdi
addq $0xb8, %rdi
movq %rdi, 0x48(%rsp)
callq 0x1d390
movq 0x60(%rsp), %rdi
addq $0xd8, %rdi
movq %rdi, 0x50(%rsp)
callq 0x1d390
movq 0x60(%rsp), %rdi
addq $0xf8, %rdi
movq %rdi, 0x58(%rsp)
callq 0x1d390
movq 0x60(%rsp), %rdi
addq $0x18, %rdi
callq 0x1d3d0
movq %rax, %rdi
movq 0x60(%rsp), %rax
movl 0x20(%rax), %esi
callq 0x5c70
jmp 0x1bea4
movq 0x60(%rsp), %rdi
addq $0x18, %rdi
callq 0x1d3d0
movq %rax, %rdi
movl $0x80000001, %esi       # imm = 0x80000001
callq 0x5ca0
jmp 0x1bec1
movq 0x60(%rsp), %rdi
addq $0x18, %rdi
callq 0x1d3d0
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x20(%rsp)
leaq 0x37d(%rip), %rcx       # 0x1c260
movq %rcx, 0x170(%rsp)
movq $0x0, 0x178(%rsp)
movq %rax, 0x168(%rsp)
leaq 0x180(%rsp), %rdi
leaq 0x170(%rsp), %rsi
leaq 0x168(%rsp), %rdx
callq 0x1d3e0
jmp 0x1bf1e
leaq 0x198(%rsp), %rdi
leaq 0x180(%rsp), %rsi
callq 0x1d420
jmp 0x1bf35
movq 0x20(%rsp), %rdi
leaq 0x198(%rsp), %rsi
callq 0x5df0
jmp 0x1bf49
leaq 0x198(%rsp), %rdi
callq 0x5ef0
movq 0x60(%rsp), %rdi
addq $0x18, %rdi
callq 0x1d3d0
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x18(%rsp)
leaq 0x3a8(%rip), %rcx       # 0x1c320
movq %rcx, 0x120(%rsp)
movq $0x0, 0x128(%rsp)
movq %rax, 0x118(%rsp)
leaq 0x130(%rsp), %rdi
leaq 0x120(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0x1d3e0
jmp 0x1bfb3
leaq 0x148(%rsp), %rdi
leaq 0x130(%rsp), %rsi
callq 0x1d420
jmp 0x1bfca
movq 0x18(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x5e20
jmp 0x1bfde
leaq 0x148(%rsp), %rdi
callq 0x5ef0
movq 0x60(%rsp), %rdi
addq $0x18, %rdi
callq 0x1d3d0
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x10(%rsp)
leaq 0x473(%rip), %rcx       # 0x1c480
movq %rcx, 0xd0(%rsp)
movq $0x0, 0xd8(%rsp)
movq %rax, 0xc8(%rsp)
leaq 0xe0(%rsp), %rdi
leaq 0xd0(%rsp), %rsi
leaq 0xc8(%rsp), %rdx
callq 0x1d3e0
jmp 0x1c048
leaq 0xf8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x1d420
jmp 0x1c05f
movq 0x10(%rsp), %rdi
leaq 0xf8(%rsp), %rsi
callq 0x5e80
jmp 0x1c073
leaq 0xf8(%rsp), %rdi
callq 0x5ef0
movq 0x60(%rsp), %rdi
addq $0x18, %rdi
callq 0x1d3d0
movq %rax, %rcx
movq 0x60(%rsp), %rax
movq %rcx, 0x8(%rsp)
leaq 0x63e(%rip), %rcx       # 0x1c6e0
movq %rcx, 0x80(%rsp)
movq $0x0, 0x88(%rsp)
movq %rax, 0x78(%rsp)
leaq 0x90(%rsp), %rdi
leaq 0x80(%rsp), %rsi
leaq 0x78(%rsp), %rdx
callq 0x1d3e0
jmp 0x1c0d7
leaq 0xa8(%rsp), %rdi
leaq 0x90(%rsp), %rsi
callq 0x1d420
jmp 0x1c0ee
movq 0x8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x5e50
jmp 0x1c102
leaq 0xa8(%rsp), %rdi
callq 0x5ef0
addq $0x1e8, %rsp            # imm = 0x1E8
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0x1c246
movq 0x70(%rsp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
callq 0x5370
jmp 0x1c246
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0x1c1f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0x198(%rsp), %rdi
callq 0x5ef0
jmp 0x1c1f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x5ef0
jmp 0x1c1f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0x5ef0
jmp 0x1c1f6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0xa8(%rsp), %rdi
callq 0x5ef0
movq 0x58(%rsp), %rdi
callq 0x68c0
movq 0x50(%rsp), %rdi
callq 0x68c0
movq 0x48(%rsp), %rdi
callq 0x68c0
movq 0x40(%rsp), %rdi
callq 0x68c0
movq 0x38(%rsp), %rdi
callq 0x6a00
movq 0x30(%rsp), %rdi
callq 0x5270
movq 0x28(%rsp), %rdi
callq 0x5270
movq 0x68(%rsp), %rdi
callq 0x1d4d0
movq 0x60(%rsp), %rdi
callq 0x1d530
movq 0x1c0(%rsp), %rdi
callq 0x5660
nopl (%rax)