// File: /workspace/github_cpp_makefile_star2_O1/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 0x410246
movq 0x90(%rbx), %r14
movq %rbx, %rdi
callq 0x4101fe
movq %r14, %rdi
callq 0x411410
testb %al, %al
je 0x40a600
movq $0x653c40, %rdi         # imm = 0x653C40
leaq 0x1c4102(%rip), %rsi    # 0x5ce091
movl $0x4, %edx
callq 0x490a00
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq *0x8(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x1c461f(%rip), %rsi    # 0x5ce5d2
callq 0x4a25e0
leaq 0x18(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x409fe0
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x409fe8
movups (%rcx), %xmm0
movups %xmm0, (%r12)
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 0x490a00
movq %rax, %r15
leaq 0x1c408b(%rip), %rsi    # 0x5ce0ab
movl $0x4, %edx
movq %rax, %rdi
callq 0x490a00
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x471b50
movsbl %al, %esi
movq %r15, %rdi
callq 0x490500
movq %rax, %rdi
callq 0x48fad0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x40a06b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x426f20
leaq 0x70(%rsp), %r13
movq -0x10(%r13), %rdi
cmpq %r13, %rdi
je 0x40a086
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x426f20
leaq 0x28(%rsp), %rdi
callq 0x410354
movq %r14, %rdi
callq 0x413ad8
movq %rax, %r14
movq %rbx, %rdi
callq 0x410246
testq %r14, %r14
je 0x40a109
movq $0x653c40, %rdi         # imm = 0x653C40
leaq 0x1c3fdb(%rip), %rsi    # 0x5ce091
movl $0x4, %edx
callq 0x490a00
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq *0x8(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x1c456c(%rip), %rsi    # 0x5ce646
callq 0x4a25e0
movq %r12, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x40a1eb
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x40a1f3
movq 0x90(%rbx), %rdi
callq 0x411410
testb %al, %al
je 0x40a18a
movq 0x90(%rbx), %rdi
callq 0x41216a
testb %al, %al
je 0x40a18a
movq $0x653b20, %rdi         # imm = 0x653B20
leaq 0x1c401c(%rip), %rsi    # 0x5ce153
movl $0x7, %edx
callq 0x490a00
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq *0x8(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x1c449e(%rip), %rsi    # 0x5ce5f9
callq 0x4a25e0
movq %r12, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x40a520
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x40a528
movq $0x653c40, %rdi         # imm = 0x653C40
leaq 0x1c3ef9(%rip), %rsi    # 0x5ce091
movl $0x4, %edx
callq 0x490a00
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq *0x8(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x1c446a(%rip), %rsi    # 0x5ce626
callq 0x4a25e0
movq %r12, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x40a45e
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x40a466
movups (%rcx), %xmm0
movups %xmm0, (%r12)
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 0x490a00
movq %rax, %r15
leaq 0x1c3e80(%rip), %rsi    # 0x5ce0ab
movl $0x4, %edx
movq %rax, %rdi
callq 0x490a00
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x471b50
movsbl %al, %esi
movq %r15, %rdi
callq 0x490500
movq %rax, %rdi
callq 0x48fad0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x40a276
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x426f20
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x40a28d
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x426f20
leaq 0x28(%rsp), %rdi
callq 0x410354
movq 0x88(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0x28(%rax)
testq %rax, %rax
je 0x40a34b
cmpb $0x0, 0xe8(%rbx)
jne 0x40a34b
movq %rax, %r15
leaq 0x98(%rbx), %rdi
movq %rax, %rsi
callq 0x40a8b2
leaq 0x1b8(%rsp), %r14
movl $0x49, %edx
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x40bd54
movq $0x652c60, %rsi         # imm = 0x652C60
movq %r15, %rdi
movq %r14, %rdx
callq 0x40dfba
leaq 0x1b8(%rsp), %rdi
callq 0x410354
movq $0x652768, %rsi         # imm = 0x652768
leaq 0x28(%rsp), %rdi
movq %r15, %rdx
callq 0x408f24
movq %rbx, %rdi
callq 0x4101fe
leaq 0x28(%rsp), %rsi
movq %rbx, %rdi
callq 0x40e18e
movq %rbx, %rdi
callq 0x410246
leaq 0x28(%rsp), %rdi
callq 0x40904a
jmp 0x40a5cc
movq $0x653b20, %rdi         # imm = 0x653B20
leaq 0x1c3dfa(%rip), %rsi    # 0x5ce153
movl $0x7, %edx
callq 0x490a00
movq (%rbx), %rax
leaq 0x28(%rsp), %rdi
movq %rbx, %rsi
callq *0x8(%rax)
leaq 0x60(%rsp), %rdi
leaq 0x1c42ef(%rip), %rsi    # 0x5ce66c
callq 0x4a25e0
movq %r12, 0x8(%rsp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x40a3a5
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x40a3ad
movups (%rcx), %xmm0
movups %xmm0, (%r12)
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 $0x653b20, %rdi         # imm = 0x653B20
callq 0x490a00
movq %rax, %r15
leaq 0x1c3cc6(%rip), %rsi    # 0x5ce0ab
movl $0x4, %edx
movq %rax, %rdi
callq 0x490a00
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x471b50
movsbl %al, %esi
movq %r15, %rdi
callq 0x490500
movq %rax, %rdi
callq 0x48fad0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x40a430
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x426f20
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x40a447
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x426f20
leaq 0x28(%rsp), %rdi
callq 0x410354
movq (%r14), %rax
movq %r14, %rdi
callq *(%rax)
jmp 0x40a5cc
movups (%rcx), %xmm0
movups %xmm0, (%r12)
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 0x490a00
movq %rax, %r14
leaq 0x1c3c0d(%rip), %rsi    # 0x5ce0ab
movl $0x4, %edx
movq %rax, %rdi
callq 0x490a00
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x471b50
movsbl %al, %esi
movq %r14, %rdi
callq 0x490500
movq %rax, %rdi
callq 0x48fad0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x40a4e9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x426f20
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x40a500
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x426f20
leaq 0x28(%rsp), %rdi
callq 0x410354
movq %rbx, %rdi
callq 0x4101fe
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x28(%rax)
jmp 0x40a600
movups (%rcx), %xmm0
movups %xmm0, (%r12)
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 $0x653b20, %rdi         # imm = 0x653B20
callq 0x490a00
movq %rax, %r14
leaq 0x1c3b4b(%rip), %rsi    # 0x5ce0ab
movl $0x4, %edx
movq %rax, %rdi
callq 0x490a00
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x471b50
movsbl %al, %esi
movq %r14, %rdi
callq 0x490500
movq %rax, %rdi
callq 0x48fad0
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x40a5ab
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x426f20
movq 0x60(%rsp), %rdi
cmpq %r13, %rdi
je 0x40a5c2
movq 0x70(%rsp), %rsi
incq %rsi
callq 0x426f20
leaq 0x28(%rsp), %rdi
callq 0x410354
movq %rbx, %rdi
callq 0x4101fe
leaq 0x28(%rsp), %r14
movl $0x41, %edx
movq %r14, %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x40bd54
movq %r14, %rdi
callq 0x4145c4
leaq 0x28(%rsp), %rdi
callq 0x410354
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x40a646
jmp 0x40a646
movq %rax, %rbx
leaq 0x1b8(%rsp), %rdi
jmp 0x40a630
jmp 0x40a646
jmp 0x40a651
jmp 0x40a646
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x410354
jmp 0x40a675
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x40904a
jmp 0x40a675
movq %rax, %rbx
jmp 0x40a66b
jmp 0x40a651
jmp 0x40a651
jmp 0x40a651
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r12, %rdi
je 0x40a66b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x426f20
leaq 0x28(%rsp), %rdi
callq 0x40512a
movq %rbx, %rdi
callq 0x4d11b0
nop