// File: roberty65[P]bServer/frame/main/Connector.cpp
// Function: beyondy::Async::Connector::sendMessage(beyondy::Async::Message*)
int Connector::sendMessage(Message *msg)
{
	if (status == CONN_CLOSE) {
		if (open() < 0) {
			SYSLOG_WARN("when sendMessage, open connector to %s failed", address);
			return -1;
		}

		SYSLOG_DEBUG("connector(%s) open OK when sendMessage", address);
	}

	if (status == CONN_OPENNING) {
		if (outQueue->size() >= (size_t)emgr->getConnectionOutQueueSize()) {
			SYSLOG_ERROR("connector fd=%d flow=%d sendMessge over-flow, out-queue-size=%ld", fd, flow, (long)outQueue->size());
			proc->onSent(msg, SS_QUEUE_FULL);
		}
		else {
			SYSLOG_DEBUG("connector(%s) is openning when sendMessage", address);
			outQueue->push_back(msg);
		}

		return 0;
	}

	assert(status == CONN_ESTABLISHED);
	SYSLOG_DEBUG("connector(%s) is established when sendMessage", address);

	return Connection::sendMessage(msg);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpl $0x0, 0xb4(%rax)
jne 0xb49b
movq -0x20(%rbp), %rdi
callq 0xb0f0
cmpl $0x0, %eax
jge 0xb454
jmp 0xb405
leaq 0xf1dc(%rip), %rax      # 0x1a5e8
movq (%rax), %rdi
movl $0x3, %esi
callq 0x4b50
cmpl $0x0, %eax
je 0xb446
movq -0x20(%rbp), %rcx
leaq 0xf1bf(%rip), %rax      # 0x1a5e8
movq (%rax), %rdi
addq $0xb8, %rcx
movl $0x3, %esi
leaq 0x7d04(%rip), %rdx      # 0x13143
movb $0x0, %al
callq 0xbf40
jmp 0xb448
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xb63e
jmp 0xb456
leaq 0xf18b(%rip), %rax      # 0x1a5e8
movq (%rax), %rdi
movl $0x5, %esi
callq 0x4b50
cmpl $0x0, %eax
je 0xb497
movq -0x20(%rbp), %rcx
leaq 0xf16e(%rip), %rax      # 0x1a5e8
movq (%rax), %rdi
addq $0xb8, %rcx
movl $0x5, %esi
leaq 0x7ce1(%rip), %rdx      # 0x13171
movb $0x0, %al
callq 0xbf40
jmp 0xb499
jmp 0xb49b
movq -0x20(%rbp), %rax
cmpl $0x1, 0xb4(%rax)
jne 0xb5bb
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rdi
callq 0x8f20
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, -0x28(%rbp)
movq 0x70(%rax), %rdi
callq 0xac40
movl %eax, %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
cmpq %rcx, %rax
jb 0xb559
jmp 0xb4dd
leaq 0xf104(%rip), %rax      # 0x1a5e8
movq (%rax), %rdi
movl $0x2, %esi
callq 0x4b50
cmpl $0x0, %eax
je 0xb53e
movq -0x20(%rbp), %rax
leaq 0xf0e7(%rip), %rcx      # 0x1a5e8
movq (%rcx), %rcx
movq %rcx, -0x38(%rbp)
movl 0x8(%rax), %ecx
movl %ecx, -0x30(%rbp)
movl 0x10(%rax), %ecx
movl %ecx, -0x2c(%rbp)
movq 0x68(%rax), %rdi
callq 0x8f20
movq -0x38(%rbp), %rdi
movl -0x30(%rbp), %ecx
movl -0x2c(%rbp), %r8d
movq %rax, %r9
movl $0x2, %esi
leaq 0x7c61(%rip), %rdx      # 0x13198
movb $0x0, %al
callq 0xbf40
jmp 0xb540
movq -0x20(%rbp), %rax
movq 0x78(%rax), %rdi
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
movl $0x3, %edx
callq *0x38(%rax)
jmp 0xb5af
jmp 0xb55b
leaq 0xf086(%rip), %rax      # 0x1a5e8
movq (%rax), %rdi
movl $0x5, %esi
callq 0x4b50
cmpl $0x0, %eax
je 0xb59c
movq -0x20(%rbp), %rcx
leaq 0xf069(%rip), %rax      # 0x1a5e8
movq (%rax), %rdi
addq $0xb8, %rcx
movl $0x5, %esi
leaq 0x7c44(%rip), %rdx      # 0x131d9
movb $0x0, %al
callq 0xbf40
jmp 0xb59e
movq -0x20(%rbp), %rax
movq 0x68(%rax), %rdi
leaq -0x18(%rbp), %rsi
callq 0x8fd0
movl $0x0, -0x4(%rbp)
jmp 0xb63e
movq -0x20(%rbp), %rax
cmpl $0x2, 0xb4(%rax)
jne 0xb5ca
jmp 0xb5e9
leaq 0x7c33(%rip), %rdi      # 0x13204
leaq 0x79ff(%rip), %rsi      # 0x12fd7
movl $0x95, %edx
leaq 0x7c3b(%rip), %rcx      # 0x1321f
callq 0x3250
jmp 0xb5eb
leaq 0xeff6(%rip), %rax      # 0x1a5e8
movq (%rax), %rdi
movl $0x5, %esi
callq 0x4b50
cmpl $0x0, %eax
je 0xb62c
movq -0x20(%rbp), %rcx
leaq 0xefd9(%rip), %rax      # 0x1a5e8
movq (%rax), %rdi
addq $0xb8, %rcx
movl $0x5, %esi
leaq 0x7c38(%rip), %rdx      # 0x1325d
movb $0x0, %al
callq 0xbf40
jmp 0xb62e
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0xa600
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)