// File: roberty65[P]bServer/frame/testServer/src/main.cpp
// Function: main
int main(int argc, char **argv)
{
	SYSLOG_INIT("../logs/server.log", LOG_LEVEL_DEBUG, 1048576, 10);	
	
	beyondy::Async::Queue<beyondy::Async::Message> *inQ = new beyondy::Async::Queue<beyondy::Async::Message>(1024);
	beyondy::Async::Queue<beyondy::Async::Message> *outQ = new beyondy::Async::Queue<beyondy::Async::Message>(2048);

	beyondy::Async::Processor *processor = new Echo();
	processor->setSendFunc(async_send_delegator, outQ);
	int retval = processor->onInit();

	beyondy::Async::MtWorker *mtWorker = new beyondy::Async::MtWorker(inQ, processor, 10);
	mtWorker->start();

	beyondy::Async::EventManager *emgr = new beyondy::Async::EventManager(outQ, 1024);

	retval = emgr->addListener("tcp://0.0.0.0:5010", inQ, processor, 100);
	if (retval < 0) {
		SYSLOG_ERROR("addListener failed");
		return 1;
	}
/*
	int cid = emgr->addConnector("inet@localhost:5010/tcp", inQ, processor, 1);
	if (cid < 0) {
		SYSLOG_ERROR("addConnector failed");
		return 2;
	}
**/
	emgr->start();

	// nothing
	processor->onExit();

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x218, %edi            # imm = 0x218
callq 0x3250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x58(%rbp)
leaq 0x9a50(%rip), %rsi      # 0xd004
movl $0x5, %edx
movl $0x100000, %ecx         # imm = 0x100000
movl $0xa, %r8d
callq 0x9a30
jmp 0x35cb
movq -0x58(%rbp), %rcx
leaq 0xfcc2(%rip), %rax      # 0x13298
movq %rcx, (%rax)
movl $0xb0, %edi
callq 0x3250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x60(%rbp)
movl $0x400, %esi            # imm = 0x400
callq 0x3830
jmp 0x35f9
movq -0x60(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0xb0, %edi
callq 0x3250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x68(%rbp)
movl $0x800, %esi            # imm = 0x800
callq 0x3830
jmp 0x3621
movq -0x68(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x30, %edi
callq 0x3250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x70(%rbp)
callq 0x3890
jmp 0x3644
movq -0x70(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x32b5(%rip), %rsi      # 0x6910
callq 0x38e0
movq -0x38(%rbp), %rdi
movq (%rdi), %rax
movq 0x20(%rax), %rax
callq *%rax
movl %eax, -0x3c(%rbp)
movl $0x20, %edi
callq 0x3250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x78(%rbp)
movq -0x28(%rbp), %rsi
movq -0x38(%rbp), %rdx
movl $0xa, %ecx
callq 0x65e0
jmp 0x3698
movq -0x78(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x6820
movl $0x70, %edi
callq 0x3250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x80(%rbp)
movq -0x30(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x4e40
jmp 0x36cd
movq -0x80(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
movq -0x28(%rbp), %rdx
movq -0x38(%rbp), %rcx
leaq 0x992f(%rip), %rsi      # 0xd017
movl $0x64, %r8d
callq 0x5130
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jge 0x37fd
jmp 0x3702
leaq 0xfb8f(%rip), %rax      # 0x13298
movq (%rax), %rdi
movl $0x2, %esi
callq 0x3910
cmpl $0x0, %eax
je 0x37f2
leaq 0xfb72(%rip), %rax      # 0x13298
movq (%rax), %rdi
movl $0x2, %esi
leaq 0x98f5(%rip), %rdx      # 0xd02a
movb $0x0, %al
callq 0x9aa0
jmp 0x37f2
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x218, %esi            # imm = 0x218
callq 0x3260
jmp 0x3823
movq -0x60(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0xb0, %esi
callq 0x3260
jmp 0x3823
movq -0x68(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0xb0, %esi
callq 0x3260
jmp 0x3823
movq -0x70(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x30, %esi
callq 0x3260
jmp 0x3823
movq -0x78(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x20, %esi
callq 0x3260
jmp 0x3823
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x18(%rbp)
movl %eax, -0x1c(%rbp)
movl $0x70, %esi
callq 0x3260
jmp 0x3823
jmp 0x37f4
movl $0x1, -0x4(%rbp)
jmp 0x3817
movq -0x50(%rbp), %rdi
callq 0x61b0
movq -0x38(%rbp), %rdi
movq (%rdi), %rax
callq *0x28(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
movq -0x18(%rbp), %rdi
callq 0x3410
nopl (%rax)