// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x30(%rdi), %r14
movq (%r14), %rdi
callq 0x3190
movq %rax, %rdi
callq 0x34b0
testq %rax, %rax
jne 0x660f
leaq 0xa8(%rbx), %r15
pushq $0x2
popq %rbp
movq %rsp, %r12
pushq $0x10
popq %r13
movl %ebp, %edi
movq %r15, %rsi
movq %r12, %rdx
movl %r13d, %ecx
callq 0x34a0
leaq 0x3b5f(%rip), %rdi      # 0xa1ab
leaq 0x54ad(%rip), %rsi      # 0xbb00
leaq 0x5484(%rip), %rdx      # 0xbade
movl $0x3f1, %ecx            # imm = 0x3F1
xorl %eax, %eax
callq 0x3080
movl %ebp, %edi
movq %r15, %rsi
movq %r12, %rdx
movl %r13d, %ecx
callq 0x34a0
movzwl 0xa6(%rbx), %ecx
rolw $0x8, %cx
movzwl %cx, %edx
leaq 0x548e(%rip), %rdi      # 0xbb19
movq %rax, %rsi
xorl %eax, %eax
callq 0x3080
leaq 0x3e42(%rip), %rdi      # 0xa4de
callq 0x36b0
movq 0x30(%rbx), %rdi
callq 0x3640
movq 0x30(%rbx), %rdi
pushq $0x6
popq %rsi
callq 0x3680
cmpl $0x5, 0x38(%rbx)
jne 0x66f0
pushq $0x10
popq %rdi
callq 0x35d0
movq %rax, %r15
movq %rbx, (%rax)
movl $0x3, 0x8(%rax)
movq 0x28(%rbx), %rax
movq 0x60(%rax), %rdi
callq 0x7c78
leaq -0xe2f(%rip), %rsi      # 0x58b6
movq %rax, %rdi
movq %r15, %rdx
callq 0x8979
movq 0x28(%rbx), %rax
movq 0x30(%rbx), %rdi
movq 0x60(%rax), %r15
callq 0x3760
movq %r15, %rdi
movq %rax, %rsi
callq 0x8088
movq 0x28(%rbx), %rax
movq 0x50(%rax), %rdi
movq %r14, %rsi
callq 0x7af0
movq %rbx, %rdi
callq 0x6745
movq 0x30(%rbx), %rdi
callq 0x3710
movq 0x30(%rbx), %rdi
callq 0x3140
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq