// File: /workspace/github_c_makefile_star2_O1/sszllzss[P]webSocket_Libevent_ThreadPool/ev_httpd.cpp
// Function: httpChilent_Close_nolock(httpChilent_t*)
void httpChilent_Close_nolock(struct httpChilent_t * client)
{
    struct sockaddr_in *address = NULL; 
    char ip[INET_ADDRSTRLEN];
    BufferevMap::iterator i;
    while(evbuffer_get_length(bufferevent_get_output(client->bev)) > 0);
    do
    {
        if(client == NULL)
        {
            De_printf("httpChilent NULL\r\n");
            break;
        }
        address = (struct sockaddr_in *)&(client->addr);
        if(address != NULL)
        {
            inet_ntop(AF_INET, &address->sin_addr,ip, INET_ADDRSTRLEN);
        }
            if(address != NULL)
                De_printf("Connection close:%s:%d\r\n", inet_ntop(AF_INET,&address->sin_addr, ip,(socklen_t) sizeof(ip)), ntohs(address->sin_port));  
            else
                De_printf("Connection close: Unknown\r\n");
    }
    while(0);
    bufferevent_lock(client->bev);
    bufferevent_disable(client->bev, EV_WRITE | EV_READ);
    if(client != NULL)
    {
        if(client->stat == HTTP_WS_DATA)
        {
            WebddSocket_Thread_Cb_arg_t * cb_arg = (WebddSocket_Thread_Cb_arg_t *)malloc(sizeof(WebddSocket_Thread_Cb_arg_t));
            cb_arg->client = client;
            cb_arg->type = Ws_Cb_Type_disconnect;
            threadpool_add(evbase_threadpool_get_threadpool(client->httpServer->evb_thpool), webSocke_thread_cb, cb_arg);
        }
        evbase_threadpool_close_event(client->httpServer->evb_thpool, bufferevent_get_base(client->bev));
        client->httpServer->clientMap->erase(client->bev);

        httpChilent_free(client);
    }
    bufferevent_unlock(client->bev);
    bufferevent_free(client->bev);

}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x30(%rbx), %rdi
callq 0x3190
movq %rax, %rdi
callq 0x3490
testq %rax, %rax
jne 0x72ae
testq %rbx, %rbx
je 0x733f
leaq 0xa8(%rbx), %r14
movq %rsp, %r15
movl $0x2, %edi
movq %r14, %rsi
movq %r15, %rdx
movl $0x10, %ecx
callq 0x3480
leaq 0x3ebc(%rip), %rdi      # 0xb1ab
leaq 0x580d(%rip), %rsi      # 0xcb03
leaq 0x57e4(%rip), %rdx      # 0xcae1
movl $0x3f1, %ecx            # imm = 0x3F1
xorl %eax, %eax
callq 0x3080
movl $0x2, %edi
movq %r14, %rsi
movq %r15, %rdx
movl $0x10, %ecx
callq 0x3480
movzwl 0xa6(%rbx), %ecx
rolw $0x8, %cx
movzwl %cx, %edx
leaq 0x57e9(%rip), %rdi      # 0xcb1c
movq %rax, %rsi
xorl %eax, %eax
callq 0x3080
jmp 0x736c
leaq 0x3e65(%rip), %rdi      # 0xb1ab
leaq 0x57b6(%rip), %rsi      # 0xcb03
leaq 0x578d(%rip), %rdx      # 0xcae1
movl $0x3e8, %ecx            # imm = 0x3E8
xorl %eax, %eax
callq 0x3080
leaq 0x5a0c(%rip), %rdi      # 0xcd73
callq 0x3680
leaq 0x30(%rbx), %r14
leaq 0x4167(%rip), %rdi      # 0xb4de
callq 0x3680
movq 0x30(%rbx), %rdi
callq 0x3610
movq 0x30(%rbx), %rdi
movl $0x6, %esi
callq 0x3650
testq %rbx, %rbx
je 0x7416
cmpl $0x5, 0x38(%rbx)
jne 0x73d4
movl $0x10, %edi
callq 0x35a0
movq %rax, %r15
movq %rbx, (%rax)
movl $0x3, 0x8(%rax)
movq 0x28(%rbx), %rax
movq 0x60(%rax), %rdi
callq 0x85bc
leaq -0x106f(%rip), %rsi     # 0x635a
movq %rax, %rdi
movq %r15, %rdx
callq 0x920d
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
movq 0x60(%rax), %r15
callq 0x3730
movq %r15, %rdi
movq %rax, %rsi
callq 0x8a8a
movq 0x28(%rbx), %rax
movq 0x50(%rax), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x8498
movq %r15, %rdi
movq %rax, %rsi
callq 0x8514
movq %rbx, %rdi
callq 0x7430
movq (%r14), %rdi
callq 0x36e0
movq (%r14), %rdi
callq 0x3140
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq