// File: guoxuanhan[P]NetServer/httpserver.cpp
// Function: HttpServer::HttpServer(EventLoop*, int, int, int)
HttpServer::HttpServer(EventLoop *loop, const int port, const int iothreadnum, const int workerthreadnum)
    : tcpserver_(loop, port, iothreadnum),
    threadpool_(workerthreadnum)
{
    tcpserver_.SetNewConnCallback(std::bind(&HttpServer::HandleNewConnection, this, std::placeholders::_1));
    tcpserver_.SetMessageCallback(std::bind(&HttpServer::HandleMessage, this, std::placeholders::_1, std::placeholders::_2));
    tcpserver_.SetSendCompleteCallback(std::bind(&HttpServer::HandleSendComplete, this, std::placeholders::_1));
    tcpserver_.SetCloseCallback(std::bind(&HttpServer::HandleClose, this, std::placeholders::_1));
    tcpserver_.SetErrorCallback(std::bind(&HttpServer::HandleError, this, std::placeholders::_1));

    threadpool_.Start(); //工作线程池启动
    TimerManager::GetTimerManagerInstance()->Start(); //HttpServer定时器管理器启动
}

// Assembly:
subq $0x218, %rsp            # imm = 0x218
movq %rdi, 0x210(%rsp)
movq %rsi, 0x208(%rsp)
movl %edx, 0x204(%rsp)
movl %ecx, 0x200(%rsp)
movl %r8d, 0x1fc(%rsp)
movq 0x210(%rsp), %rdi
movq %rdi, 0x48(%rsp)
movq %rdi, %rax
movq %rax, 0x38(%rsp)
callq 0xd5b0
movq 0x48(%rsp), %rdi
addq $0x30, %rdi
movq %rdi, 0x40(%rsp)
callq 0xd5c0
movq 0x48(%rsp), %rdi
addq $0x60, %rdi
callq 0x8970
movq 0x48(%rsp), %rdi
addq $0x88, %rdi
movq %rdi, 0x50(%rsp)
movq 0x208(%rsp), %rsi
movl 0x204(%rsp), %edx
movl 0x200(%rsp), %ecx
callq 0x1f190
jmp 0xc016
movq 0x38(%rsp), %rdi
addq $0x250, %rdi            # imm = 0x250
movq %rdi, 0x30(%rsp)
movl 0x1fc(%rsp), %esi
callq 0x23010
jmp 0xc035
movq 0x38(%rsp), %rax
movq %rax, %rcx
addq $0x88, %rcx
movq %rcx, 0x28(%rsp)
leaq 0x430(%rip), %rcx       # 0xc480
movq %rcx, 0x1a0(%rsp)
movq $0x0, 0x1a8(%rsp)
movq %rax, 0x198(%rsp)
movq 0x2ef25(%rip), %rcx     # 0x3af98
leaq 0x1b0(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
leaq 0x198(%rsp), %rdx
callq 0xd5d0
jmp 0xc092
leaq 0x1c8(%rsp), %rdi
leaq 0x1b0(%rsp), %rsi
callq 0xd610
jmp 0xc0a9
movq 0x28(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
callq 0x67a0
jmp 0xc0bd
leaq 0x1c8(%rsp), %rdi
callq 0x68c0
movq 0x38(%rsp), %rax
movq %rax, %rcx
addq $0x88, %rcx
movq %rcx, 0x20(%rsp)
leaq 0x54b(%rip), %rcx       # 0xc630
movq %rcx, 0x150(%rsp)
movq $0x0, 0x158(%rsp)
movq %rax, 0x148(%rsp)
movq 0x2ee90(%rip), %rcx     # 0x3af98
movq 0x2eee1(%rip), %r8      # 0x3aff0
leaq 0x160(%rsp), %rdi
leaq 0x150(%rsp), %rsi
leaq 0x148(%rsp), %rdx
callq 0xd6c0
jmp 0xc12e
leaq 0x178(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0xd710
jmp 0xc145
movq 0x20(%rsp), %rdi
leaq 0x178(%rsp), %rsi
callq 0x68d0
jmp 0xc159
leaq 0x178(%rsp), %rdi
callq 0x6a00
movq 0x38(%rsp), %rax
movq %rax, %rcx
addq $0x88, %rcx
movq %rcx, 0x18(%rsp)
leaq 0xc4f(%rip), %rcx       # 0xcdd0
movq %rcx, 0x100(%rsp)
movq $0x0, 0x108(%rsp)
movq %rax, 0xf8(%rsp)
movq 0x2edf4(%rip), %rcx     # 0x3af98
leaq 0x110(%rsp), %rdi
leaq 0x100(%rsp), %rsi
leaq 0xf8(%rsp), %rdx
callq 0xd5d0
jmp 0xc1c3
leaq 0x128(%rsp), %rdi
leaq 0x110(%rsp), %rsi
callq 0xd610
jmp 0xc1da
movq 0x18(%rsp), %rdi
leaq 0x128(%rsp), %rsi
callq 0x6a10
jmp 0xc1ee
leaq 0x128(%rsp), %rdi
callq 0x68c0
movq 0x38(%rsp), %rax
movq %rax, %rcx
addq $0x88, %rcx
movq %rcx, 0x10(%rsp)
leaq 0xbca(%rip), %rcx       # 0xcde0
movq %rcx, 0xb0(%rsp)
movq $0x0, 0xb8(%rsp)
movq %rax, 0xa8(%rsp)
movq 0x2ed5f(%rip), %rcx     # 0x3af98
leaq 0xc0(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0xd5d0
jmp 0xc258
leaq 0xd8(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0xd610
jmp 0xc26f
movq 0x10(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0x6a40
jmp 0xc283
leaq 0xd8(%rsp), %rdi
callq 0x68c0
movq 0x38(%rsp), %rax
movq %rax, %rcx
addq $0x88, %rcx
movq %rcx, 0x8(%rsp)
leaq 0xbb5(%rip), %rcx       # 0xce60
movq %rcx, 0x60(%rsp)
movq $0x0, 0x68(%rsp)
movq %rax, 0x58(%rsp)
movq 0x2ecd3(%rip), %rcx     # 0x3af98
leaq 0x70(%rsp), %rdi
leaq 0x60(%rsp), %rsi
leaq 0x58(%rsp), %rdx
callq 0xd5d0
jmp 0xc2db
leaq 0x88(%rsp), %rdi
leaq 0x70(%rsp), %rsi
callq 0xd610
jmp 0xc2ef
movq 0x8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x6a70
jmp 0xc303
leaq 0x88(%rsp), %rdi
callq 0x68c0
movq 0x38(%rsp), %rdi
addq $0x250, %rdi            # imm = 0x250
callq 0x23210
jmp 0xc323
callq 0x260d0
movq %rax, (%rsp)
jmp 0xc32e
movq (%rsp), %rdi
callq 0x268c0
jmp 0xc339
addq $0x218, %rsp            # imm = 0x218
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
jmp 0xc450
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
jmp 0xc446
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
jmp 0xc43c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0x1c8(%rsp), %rdi
callq 0x68c0
jmp 0xc43c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0x178(%rsp), %rdi
callq 0x6a00
jmp 0xc43c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0x128(%rsp), %rdi
callq 0x68c0
jmp 0xc43c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0xd8(%rsp), %rdi
callq 0x68c0
jmp 0xc43c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1f0(%rsp)
movl %eax, 0x1ec(%rsp)
leaq 0x88(%rsp), %rdi
callq 0x68c0
movq 0x30(%rsp), %rdi
callq 0x230c0
movq 0x50(%rsp), %rdi
callq 0x1f8c0
movq 0x40(%rsp), %rdi
callq 0xd7c0
movq 0x48(%rsp), %rdi
callq 0xd7d0
movq 0x1f0(%rsp), %rdi
callq 0x5660
nopw %cs:(%rax,%rax)