// File: yckwong[P]tinywebserver/webserver.cpp
// Function: WebServer::timer(int, sockaddr_in)
void WebServer::timer(int connfd, struct sockaddr_in client_address)
{
    users[connfd].init(connfd, client_address, m_root, m_SQLVerify, m_TRIGMode, m_close_log, m_user, m_passWord, m_databaseName);

    //初始化client_data数据
    //创建定时器，设置回调函数和超时时间，绑定用户数据，将定时器添加到链表中
    users_timer[connfd].address = client_address;
    users_timer[connfd].sockfd = connfd;
    util_timer *timer = new util_timer;
    timer->user_data = &users_timer[connfd];
    timer->cb_func = cb_func;
    time_t cur = time(NULL);
    timer->expire = cur + 3 * TIMESLOT;
    users_timer[connfd].timer = timer;
    timer_lst.add_timer(timer);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdx, -0x10(%rbp)
movq %rcx, -0x8(%rbp)
movq %rdi, -0x18(%rbp)
movl %esi, -0x1c(%rbp)
movq -0x18(%rbp), %rsi
movq %rsi, -0xa8(%rbp)
movq 0x28(%rsi), %rax
movslq -0x1c(%rbp), %rcx
movl %ecx, %edx
movl %edx, -0xcc(%rbp)
imulq $0xf68, %rcx, %rcx      # imm = 0xF68
addq %rcx, %rax
movq %rax, -0xc8(%rbp)
movq 0x8(%rsi), %rax
movq %rax, -0xc0(%rbp)
movl 0x9c(%rsi), %eax
movl %eax, -0xb4(%rbp)
movl 0x1d574(%rsi), %eax
movl %eax, -0xb0(%rbp)
movl 0x14(%rsi), %eax
movl %eax, -0xac(%rbp)
addq $0x38, %rsi
leaq -0x40(%rbp), %rdi
callq 0x41b0
movq -0xa8(%rbp), %rsi
addq $0x58, %rsi
leaq -0x60(%rbp), %rdi
callq 0x41b0
jmp 0xd845
movq -0xa8(%rbp), %rsi
addq $0x78, %rsi
leaq -0x90(%rbp), %rdi
callq 0x41b0
jmp 0xd85e
movl -0xb0(%rbp), %r9d
movl -0xb4(%rbp), %r8d
movq -0xc0(%rbp), %rcx
movl -0xcc(%rbp), %esi
movq -0xc8(%rbp), %rdi
movl -0xac(%rbp), %edx
movq %rsp, %rax
leaq -0x90(%rbp), %r10
movq %r10, 0x18(%rax)
leaq -0x60(%rbp), %r10
movq %r10, 0x10(%rax)
leaq -0x40(%rbp), %r10
movq %r10, 0x8(%rax)
movl %edx, (%rax)
leaq -0x10(%rbp), %rdx
callq 0x62e0
jmp 0xd8b1
leaq -0x90(%rbp), %rdi
callq 0x42d0
leaq -0x60(%rbp), %rdi
callq 0x42d0
leaq -0x40(%rbp), %rdi
callq 0x42d0
movq -0xa8(%rbp), %rax
movq 0x1d588(%rax), %rcx
movslq -0x1c(%rbp), %rdx
shlq $0x5, %rdx
movups -0x10(%rbp), %xmm0
movups %xmm0, (%rcx,%rdx)
movslq -0x1c(%rbp), %rcx
movl %ecx, %edx
movq 0x1d588(%rax), %rax
shlq $0x5, %rcx
movl %edx, 0x10(%rax,%rcx)
movl $0x28, %edi
callq 0x44a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xd8(%rbp)
callq 0xe860
jmp 0xd920
movq -0xa8(%rbp), %rax
movq -0xd8(%rbp), %rcx
movq %rcx, -0x98(%rbp)
movq 0x1d588(%rax), %rcx
movslq -0x1c(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rcx
movq -0x98(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x98(%rbp), %rax
leaq -0x7f70(%rip), %rcx     # 0x59f0
movq %rcx, 0x8(%rax)
xorl %eax, %eax
movl %eax, %edi
callq 0x4450
movq -0xa8(%rbp), %rdi
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rcx
addq $0xf, %rcx
movq -0x98(%rbp), %rax
movq %rcx, (%rax)
movq -0x98(%rbp), %rcx
movq 0x1d588(%rdi), %rax
movslq -0x1c(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
addq $0x1d578, %rdi          # imm = 0x1D578
movq -0x98(%rbp), %rsi
callq 0x5340
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xda06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0xd9fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x42d0
leaq -0x60(%rbp), %rdi
callq 0x42d0
leaq -0x40(%rbp), %rdi
callq 0x42d0
jmp 0xda2e
movq -0xd8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0x28, %esi
callq 0x44b0
movq -0x68(%rbp), %rdi
callq 0x47d0
nopw (%rax,%rax)