// File: enbock[P]Warp10Server/warp10server/src/Server.cpp
// Function: Warp10::Server::Server(u::Vector<u::String>)
Server::Server(Vector<String> arg) : RoomOwner()
{
	// connect Ctrl+C with shutdown
	signal((int)SIGINT, OSEventHandler);
	signal((int)SIGKILL, OSEventHandler);
	signal((int)SIGABRT, OSEventHandler);
	signal((int)SIGTERM, OSEventHandler);

	_isShuttingDown = false;

	_room.addEventListener(
		ServerEvent::SHUTDOWN, 
		Callback(this, cb_cast(&Server::onShutdown))
	);

	_manager.addEventListener(
		u::Network::Event::CLOSED, 
		Callback(this, cb_cast(&Server::onManagerClosed))
	);

	trace(className() + ": Server is running.");

	_webService = new WebService(&_manager, "0.0.0.0", 80);
	_webService->registerNetwork();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x230, %rsp            # imm = 0x230
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x1e0(%rbp)
callq 0x419ed0
movq -0x1e0(%rbp), %rdi
leaq 0x255fcf(%rip), %rax    # 0x65cce0
movq %rax, (%rdi)
addq $0xc0, %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x41fff0
jmp 0x406d29
leaq 0x430(%rip), %rsi       # 0x407160
movq %rsi, -0x1f0(%rbp)
movl $0x2, %edi
callq 0x4f9aa0
movq -0x1f0(%rbp), %rsi
movl $0x9, %edi
callq 0x4f9aa0
movq -0x1f0(%rbp), %rsi
movl $0x6, %edi
callq 0x4f9aa0
movq -0x1f0(%rbp), %rsi
movl $0xf, %edi
callq 0x4f9aa0
movq -0x1e0(%rbp), %rsi
movb $0x0, 0x228(%rsi)
movq %rsi, %rax
addq $0x38, %rax
movq %rax, -0x1e8(%rbp)
leaq 0x429(%rip), %rax       # 0x4071c0
movq %rax, -0x88(%rbp)
movq $0x0, -0x80(%rbp)
movq -0x88(%rbp), %rdx
movq -0x80(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
leaq -0x78(%rbp), %rdi
callq 0x410a10
jmp 0x406dc1
movq -0x1e8(%rbp), %rdi
movq $0x667610, %rsi         # imm = 0x667610
leaq -0x78(%rbp), %rdx
callq 0x412620
jmp 0x406dda
leaq -0x78(%rbp), %rdi
callq 0x407e40
movq -0x1e0(%rbp), %rsi
movq %rsi, %rax
addq $0xc0, %rax
movq %rax, -0x1f8(%rbp)
leaq 0x62f(%rip), %rax       # 0x407430
movq %rax, -0xf0(%rbp)
movq $0x0, -0xe8(%rbp)
movq -0xf0(%rbp), %rdx
movq -0xe8(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
leaq -0xe0(%rbp), %rdi
callq 0x410a10
jmp 0x406e34
movq -0x1f8(%rbp), %rdi
movq $0x667c80, %rsi         # imm = 0x667C80
leaq -0xe0(%rbp), %rdx
callq 0x412620
jmp 0x406e50
leaq -0xe0(%rbp), %rdi
callq 0x407e40
movq $0x668c60, %rdi         # imm = 0x668C60
leaq 0x1d4227(%rip), %rsi    # 0x5db091
callq 0x49dd60
movq %rax, -0x200(%rbp)
jmp 0x406e78
movb $0x0, -0x169(%rbp)
movb $0x0, -0x16b(%rbp)
movb $0x1, %al
testb $0x1, %al
jne 0x406e8e
jmp 0x406ecc
movq -0x1e0(%rbp), %rsi
movq (%rsi), %rax
movq 0x8(%rax), %rax
leaq -0x168(%rbp), %rdi
callq *%rax
jmp 0x406ea7
movb $0x1, -0x169(%rbp)
leaq -0x130(%rbp), %rsi
leaq 0x1d41ff(%rip), %rdx    # 0x5db0bb
leaq -0x110(%rbp), %rdi
callq 0x405d00
jmp 0x406eca
jmp 0x406f04
leaq -0x16a(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0x435b90
movq -0x208(%rbp), %rdx
movb $0x1, -0x16b(%rbp)
leaq 0x1f9aae(%rip), %rsi    # 0x6009a2
leaq -0x110(%rbp), %rdi
callq 0x407e60
jmp 0x406f02
jmp 0x406f04
movq -0x200(%rbp), %rdi
leaq -0x110(%rbp), %rsi
callq 0x4b05e0
movq %rax, -0x210(%rbp)
jmp 0x406f20
movq -0x210(%rbp), %rdi
leaq 0x1d41a2(%rip), %rsi    # 0x5db0d0
callq 0x49dd60
movq %rax, -0x218(%rbp)
jmp 0x406f3c
movq -0x218(%rbp), %rdi
movq $0x49d640, %rsi         # imm = 0x49D640
callq 0x49c850
jmp 0x406f51
leaq -0x110(%rbp), %rdi
callq 0x4adc60
testb $0x1, -0x16b(%rbp)
jne 0x406f68
jmp 0x406f74
leaq -0x16a(%rbp), %rdi
callq 0x435bb0
testb $0x1, -0x169(%rbp)
jne 0x406f7f
jmp 0x406f8b
leaq -0x168(%rbp), %rdi
callq 0x405650
movl $0x190, %edi            # imm = 0x190
callq 0x434cd0
movq %rax, -0x220(%rbp)
jmp 0x406f9e
movq -0x1e0(%rbp), %rax
movb $0x1, -0x1c9(%rbp)
addq $0xc0, %rax
movq %rax, -0x228(%rbp)
leaq 0x1d4115(%rip), %rsi    # 0x5db0d5
leaq -0x1c8(%rbp), %rdi
callq 0x417c40
jmp 0x406fce
movq -0x228(%rbp), %rsi
movq -0x220(%rbp), %rdi
leaq -0x1c8(%rbp), %rdx
movl $0x50, %ecx
callq 0x408300
jmp 0x406fef
movq -0x1e0(%rbp), %rax
movq -0x220(%rbp), %rcx
movb $0x0, -0x1c9(%rbp)
movq %rcx, 0x230(%rax)
leaq -0x1c8(%rbp), %rdi
callq 0x405650
movq -0x1e0(%rbp), %rax
movq 0x230(%rax), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
jmp 0x407030
addq $0x230, %rsp            # imm = 0x230
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x407148
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x40713c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x407e40
jmp 0x40713c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0x407e40
jmp 0x40713c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x4070df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x4070c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x4adc60
testb $0x1, -0x16b(%rbp)
jne 0x4070d1
jmp 0x4070dd
leaq -0x16a(%rbp), %rdi
callq 0x435bb0
jmp 0x4070df
testb $0x1, -0x169(%rbp)
jne 0x4070ea
jmp 0x4070f6
leaq -0x168(%rbp), %rdi
callq 0x405650
jmp 0x40713c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
jmp 0x40711e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
leaq -0x1c8(%rbp), %rdi
callq 0x405650
testb $0x1, -0x1c9(%rbp)
jne 0x407129
jmp 0x40713a
movq -0x220(%rbp), %rdi
movl $0x190, %esi            # imm = 0x190
callq 0x433cf0
jmp 0x40713c
movq -0x1d8(%rbp), %rdi
callq 0x420220
movq -0x1e0(%rbp), %rdi
callq 0x41a1d0
movq -0x18(%rbp), %rdi
callq 0x4deb40
nopl (%rax)