// File: /workspace/github_cpp_makefile_star2_O3/enbock[P]Warp10Server/warp10server/src/Network/WebListener.cpp
// Function: Warp10::Network::WebListener::listenSocket(u::Object*)
void WebListener::listenSocket(Object* arg)
{
	lock();
	Socket* listener = _socket;
	unlock();

	if(!valid(listener)) return;
	trace(className() + "::listenSocket: Wait for connection...");
	Socket* newSocket = listener->accept();

	lock();
	if(newSocket == null)
	{
		// listening interrupted...socket closed?
		if(valid(_socket) && _socket->isConnected())
		{
			error(className()+"::listenSocket: Error on getting connection.");
		}
		else
		{
			trace(className() + "::listenSocket: Stop listening.");
			unlock();
			checkClosed();
			return;
		}
	}
	else
	{
		trace(className()+"::listenSocket: Incomming connection.");
		IConnection* newConnection = _builder->createConnection(newSocket);
		if(newConnection != null && _isClosed == false)
		{
			_connections.push(newConnection);

			newConnection->addEventListener(
				u::Network::Event::CLOSED
				, Callback(
					this, cb_cast(&WebListener::onConnectionClosed)
				)
			);

			WebEvent connectionCreated(
				WebEvent::INCOMMING_CONNECTION
				, (WebConnection*)newConnection
			);
			unlock();
			dispatchEvent(&connectionCreated);
			lock();
		}
		else
		{
			error(
				className()
				+ "::listenSocket: Can not etablish incomming conection"
			);
			newSocket->destroy();
		}
	}
	unlock();

	//self start ;)
	Callback cb(this, cb_cast(&WebListener::listenSocket));
	ThreadSystem::create(&cb);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
movq %rdi, %rbx
callq 0x410226
movq 0x90(%rbx), %r14
movq %rbx, %rdi
callq 0x4101de
movq %r14, %rdi
callq 0x411402
testb %al, %al
je 0x40a57b
movq $0x653c40, %rdi         # imm = 0x653C40
leaq 0x1c4178(%rip), %rsi    # 0x5ce091
movl $0x4, %edx
callq 0x490910
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq *0x8(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x1c4695(%rip), %rsi    # 0x5ce5d2
callq 0x4a24f0
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x409f69
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x409f71
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq $0x653c40, %rdi         # imm = 0x653C40
callq 0x490910
movq %rax, %r15
leaq 0x1c4102(%rip), %rsi    # 0x5ce0ab
movl $0x4, %edx
movq %rax, %rdi
callq 0x490910
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x471a60
movsbl %al, %esi
movq %r15, %rdi
callq 0x490410
movq %rax, %rdi
callq 0x48f9e0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x409ff4
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x426e30
leaq 0x70(%rsp), %r12
movq -0x10(%r12), %rdi
cmpq %r12, %rdi
je 0x40a010
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x426e30
leaq 0x28(%rsp), %rdi
callq 0x410332
movq %r14, %rdi
callq 0x413a8c
movq %rax, %r14
movq %rbx, %rdi
callq 0x410226
testq %r14, %r14
je 0x40a093
movq $0x653c40, %rdi         # imm = 0x653C40
leaq 0x1c4051(%rip), %rsi    # 0x5ce091
movl $0x4, %edx
callq 0x490910
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq *0x8(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x1c45e2(%rip), %rsi    # 0x5ce646
callq 0x4a24f0
movq %r13, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x40a17d
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x40a185
movq 0x90(%rbx), %rdi
callq 0x411402
testb %al, %al
je 0x40a118
movq 0x90(%rbx), %rdi
callq 0x412156
testb %al, %al
je 0x40a118
movq $0x653b20, %rdi         # imm = 0x653B20
leaq 0x1c4092(%rip), %rsi    # 0x5ce153
movl $0x7, %edx
callq 0x490910
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq *0x8(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x1c4514(%rip), %rsi    # 0x5ce5f9
callq 0x4a24f0
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x40a4a3
movq %rsi, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x40a4ad
movq $0x653c40, %rdi         # imm = 0x653C40
leaq 0x1c3f6b(%rip), %rsi    # 0x5ce091
movl $0x4, %edx
callq 0x490910
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq *0x8(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x1c44dc(%rip), %rsi    # 0x5ce626
callq 0x4a24f0
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x40a3e9
movq %rsi, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x40a3f3
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq $0x653c40, %rdi         # imm = 0x653C40
callq 0x490910
movq %rax, %r15
leaq 0x1c3eee(%rip), %rsi    # 0x5ce0ab
movl $0x4, %edx
movq %rax, %rdi
callq 0x490910
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x471a60
movsbl %al, %esi
movq %r15, %rdi
callq 0x490410
movq %rax, %rdi
callq 0x48f9e0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x40a208
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x426e30
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x40a21f
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x426e30
leaq 0x28(%rsp), %rdi
callq 0x410332
movq 0x88(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x28(%rax)
testq %rax, %rax
je 0x40a2dd
cmpb $0x0, 0xe8(%rbx)
jne 0x40a2dd
movq %rax, %r15
leaq 0x98(%rbx), %rdi
movq %rax, %rsi
callq 0x40a832
leaq 0x1b8(%rsp), %r14
movl $0x49, %edx
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x40bcd8
movq $0x652c60, %rsi         # imm = 0x652C60
movq %r15, %rdi
movq %r14, %rdx
callq 0x40ded4
leaq 0x1b8(%rsp), %rdi
callq 0x410332
movq $0x652768, %rsi         # imm = 0x652768
leaq 0x28(%rsp), %rdi
movq %r15, %rdx
callq 0x408ec4
movq %rbx, %rdi
callq 0x4101de
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x40e11a
movq %rbx, %rdi
callq 0x410226
leaq 0x28(%rsp), %rdi
callq 0x408fea
jmp 0x40a547
movq $0x653b20, %rdi         # imm = 0x653B20
leaq 0x1c3e68(%rip), %rsi    # 0x5ce153
movl $0x7, %edx
callq 0x490910
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq *0x8(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x1c435d(%rip), %rsi    # 0x5ce66c
callq 0x4a24f0
movq %r13, 0x8(%rsp)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x40a337
movq %rsi, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x40a342
movups (%rcx), %xmm0
movups %xmm0, (%r13)
movq %r13, %rsi
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq $0x653b20, %rdi         # imm = 0x653B20
callq 0x490910
movq %rax, %r15
leaq 0x1c3d3b(%rip), %rsi    # 0x5ce0ab
movl $0x4, %edx
movq %rax, %rdi
callq 0x490910
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x471a60
movsbl %al, %esi
movq %r15, %rdi
callq 0x490410
movq %rax, %rdi
callq 0x48f9e0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x40a3bb
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x426e30
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x40a3d2
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x426e30
leaq 0x28(%rsp), %rdi
callq 0x410332
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
jmp 0x40a547
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %r15, %rsi
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq $0x653c40, %rdi         # imm = 0x653C40
callq 0x490910
movq %rax, %r14
leaq 0x1c3c8a(%rip), %rsi    # 0x5ce0ab
movl $0x4, %edx
movq %rax, %rdi
callq 0x490910
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x471a60
movsbl %al, %esi
movq %r14, %rdi
callq 0x490410
movq %rax, %rdi
callq 0x48f9e0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x40a46c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x426e30
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x40a483
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x426e30
leaq 0x28(%rsp), %rdi
callq 0x410332
movq %rbx, %rdi
callq 0x4101de
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x28(%rax)
jmp 0x40a57b
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq %r15, %rsi
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq $0x653b20, %rdi         # imm = 0x653B20
callq 0x490910
movq %rax, %r14
leaq 0x1c3bd0(%rip), %rsi    # 0x5ce0ab
movl $0x4, %edx
movq %rax, %rdi
callq 0x490910
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x471a60
movsbl %al, %esi
movq %r14, %rdi
callq 0x490410
movq %rax, %rdi
callq 0x48f9e0
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x40a526
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x426e30
movq 0x60(%rsp), %rdi
cmpq %r12, %rdi
je 0x40a53d
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x426e30
leaq 0x28(%rsp), %rdi
callq 0x410332
movq %rbx, %rdi
callq 0x4101de
leaq 0x28(%rsp), %r14
movl $0x41, %edx
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x40bcd8
movq %r14, %rdi
callq 0x414564
leaq 0x28(%rsp), %rdi
callq 0x410332
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x40a5c1
jmp 0x40a5c1
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
jmp 0x40a5ab
jmp 0x40a5c1
jmp 0x40a5c6
jmp 0x40a5c1
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x410332
jmp 0x40a5fd
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x408fea
jmp 0x40a5fd
movq %rax, %rbx
jmp 0x40a5f3
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0x40a5e6
jmp 0x40a5f3
jmp 0x40a5d9
jmp 0x40a5d9
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x40a5f3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x426e30
leaq 0x28(%rsp), %rdi
callq 0x40512c
movq %rbx, %rdi
callq 0x4d10c0
nop