// File: /workspace/github_c_makefile_star2_O3/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 %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x30(%rdi), %r14
movq (%r14), %rdi
callq 0x3190
movq %rax, %rdi
callq 0x3490
testq %rax, %rax
jne 0x72a0
leaq 0xa8(%rbx), %r15
movq %rsp, %r12
movl $0x2, %edi
movq %r15, %rsi
movq %r12, %rdx
movl $0x10, %ecx
callq 0x3480
leaq 0x3ed0(%rip), %rdi      # 0xb1ab
leaq 0x581e(%rip), %rsi      # 0xcb00
leaq 0x57f5(%rip), %rdx      # 0xcade
movl $0x3f1, %ecx            # imm = 0x3F1
xorl %eax, %eax
callq 0x3080
movl $0x2, %edi
movq %r15, %rsi
movq %r12, %rdx
movl $0x10, %ecx
callq 0x3480
movzwl 0xa6(%rbx), %ecx
rolw $0x8, %cx
movzwl %cx, %edx
leaq 0x57fa(%rip), %rdi      # 0xcb19
movq %rax, %rsi
xorl %eax, %eax
callq 0x3080
leaq 0x41ae(%rip), %rdi      # 0xb4de
callq 0x3680
movq 0x30(%rbx), %rdi
callq 0x3610
movq 0x30(%rbx), %rdi
movl $0x6, %esi
callq 0x3650
cmpl $0x5, 0x38(%rbx)
jne 0x7388
movl $0x10, %edi
callq 0x35a0
movq %rax, %r15
movq %rbx, (%rax)
movl $0x3, 0x8(%rax)
movq 0x28(%rbx), %rax
movq 0x60(%rax), %rdi
callq 0x855c
leaq -0xfb2(%rip), %rsi      # 0x63cb
movq %rax, %rdi
movq %r15, %rdx
callq 0x9179
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
movq 0x60(%rax), %r15
callq 0x3730
movq %r15, %rdi
movq %rax, %rsi
callq 0x89ed
movq 0x28(%rbx), %rax
movq 0x50(%rax), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x8434
movq %r15, %rdi
movq %rax, %rsi
callq 0x84b6
movq %rbx, %rdi
callq 0x73e8
movq 0x30(%rbx), %rdi
callq 0x36e0
movq 0x30(%rbx), %rdi
callq 0x3140
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq