// File: st0ne[P]XReflectorPlus/dxrfd.cpp
// Function: send_heartbeat()
static void send_heartbeat()
{
   inbound_type::iterator pos;
   inbound_type::iterator temp_pos = inbound_list.end();
   inbound *inbound_ptr;
   blocks_type::iterator block_pos;
   char dropped = ' ';
  
   for (pos = inbound_list.begin(); pos != inbound_list.end(); pos++)
   {
      inbound_ptr = (inbound *)pos->second;
 
      block_pos = blocks.find(inbound_ptr->call);
 
      if (block_pos == blocks.end())  /* not blocked */
      { 
         sendto(ref_sock,(char *)REF_ACK,3,0,
                (struct sockaddr *)&(inbound_ptr->sin),
                sizeof(struct sockaddr_in));
   
         if (inbound_ptr->countdown >= 0)
            inbound_ptr->countdown --;

         if (inbound_ptr->countdown < 0)
         {
            dropped = 't'; // timeout
            temp_pos = pos;
         }
      }
      else
      {
         dropped = 'b'; // blocked
         temp_pos = pos;
      }

   }

   if (temp_pos != inbound_list.end())
   {
      inbound_ptr = (inbound *)temp_pos->second;

      traceit("call=%s %s, removing %s\n", 
                inbound_ptr->call, 
                (dropped == 't')?"timeout":"blocked",
                temp_pos->first.c_str());

      if (dropped == 'b')
      {
         /* disconnect */
         refbuf[0] = 5;
         refbuf[1] = 0;
         refbuf[2] = 24;
         refbuf[3] = 0;
         refbuf[4] = 0;
         sendto(ref_sock,(char *)refbuf,5,0,
                (struct sockaddr *)&(inbound_ptr->sin),
                sizeof(struct sockaddr_in));
      }

      free(temp_pos->second);
      temp_pos->second = NULL;
      inbound_list.erase(temp_pos);

      print_links_file();
   }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
leaq -0x8(%rbp), %rdi
callq 0x10840
leaq 0x11945(%rip), %rdi     # 0x1f350
callq 0x108c0
movq %rax, -0x10(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x13370
movb $0x20, -0x21(%rbp)
leaq 0x11928(%rip), %rdi     # 0x1f350
callq 0x10860
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
leaq 0x11910(%rip), %rdi     # 0x1f350
callq 0x108c0
movq %rax, -0x38(%rbp)
leaq -0x8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x10890
testb $0x1, %al
jne 0xda5f
jmp 0xdbbf
leaq -0x8(%rbp), %rdi
callq 0x108f0
movq 0x20(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0x61(%rbp), %rdi
movq %rdi, -0xa8(%rbp)
callq 0x3520
movq -0xb0(%rbp), %rsi
movq -0xa8(%rbp), %rdx
leaq -0x60(%rbp), %rdi
callq 0x11f00
jmp 0xdaa4
leaq 0x11935(%rip), %rdi     # 0x1f3e0
leaq -0x60(%rbp), %rsi
callq 0x14250
movq %rax, -0xb8(%rbp)
jmp 0xdabd
movq -0xb8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x31e0
leaq -0x61(%rbp), %rdi
callq 0x3330
leaq 0x118f7(%rip), %rdi     # 0x1f3e0
callq 0x13480
movq %rax, -0x80(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x14720
testb $0x1, %al
jne 0xdb08
jmp 0xdb9a
movl 0x117d2(%rip), %edi     # 0x1f2e0
movq -0x18(%rbp), %r8
addq $0x18, %r8
leaq 0x117dd(%rip), %rsi     # 0x1f2fa
movl $0x3, %edx
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x3080
movq -0x18(%rbp), %rax
movswl 0x28(%rax), %eax
cmpl $0x0, %eax
jl 0xdb7f
movq -0x18(%rbp), %rax
movw 0x28(%rax), %cx
addw $-0x1, %cx
movw %cx, 0x28(%rax)
jmp 0xdb7f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
jmp 0xdb71
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x70(%rbp)
movl %eax, -0x74(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x31e0
leaq -0x61(%rbp), %rdi
callq 0x3330
jmp 0xdd17
movq -0x18(%rbp), %rax
movswl 0x28(%rax), %eax
cmpl $0x0, %eax
jge 0xdb98
movb $0x74, -0x21(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0xdba6
movb $0x62, -0x21(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0xdba8
leaq -0x8(%rbp), %rdi
xorl %esi, %esi
callq 0x10910
movq %rax, -0x88(%rbp)
jmp 0xda39
leaq 0x1178a(%rip), %rdi     # 0x1f350
callq 0x108c0
movq %rax, -0x90(%rbp)
leaq -0x10(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x10890
testb $0x1, %al
jne 0xdbeb
jmp 0xdd0e
leaq -0x10(%rbp), %rdi
callq 0x108f0
movq 0x20(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xc0(%rbp)
movsbl -0x21(%rbp), %eax
cmpl $0x74, %eax
jne 0xdc20
leaq 0xa080(%rip), %rax      # 0x17c97
movq %rax, -0xc8(%rbp)
jmp 0xdc30
leaq 0xa078(%rip), %rax      # 0x17c9f
movq %rax, -0xc8(%rbp)
jmp 0xdc30
movq -0xc8(%rbp), %rax
movq %rax, -0xd0(%rbp)
leaq -0x10(%rbp), %rdi
callq 0x108f0
movq %rax, %rdi
callq 0x3140
movq -0xc0(%rbp), %rsi
movq -0xd0(%rbp), %rdx
movq %rax, %rcx
leaq 0xa017(%rip), %rdi      # 0x17c7e
movb $0x0, %al
callq 0x3820
movsbl -0x21(%rbp), %eax
cmpl $0x62, %eax
jne 0xdcc1
movb $0x5, 0x13af2(%rip)     # 0x21770
movb $0x0, 0x13aec(%rip)     # 0x21771
movb $0x18, 0x13ae6(%rip)    # 0x21772
movb $0x0, 0x13ae0(%rip)     # 0x21773
movb $0x0, 0x13ada(%rip)     # 0x21774
movl 0x11640(%rip), %edi     # 0x1f2e0
movq -0x18(%rbp), %r8
addq $0x18, %r8
leaq 0x13ac1(%rip), %rsi     # 0x21770
movl $0x5, %edx
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x3080
leaq -0x10(%rbp), %rdi
callq 0x108f0
movq 0x20(%rax), %rdi
callq 0x3390
leaq -0x10(%rbp), %rdi
callq 0x108f0
movq $0x0, 0x20(%rax)
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x98(%rbp), %rsi
leaq 0x11653(%rip), %rdi     # 0x1f350
callq 0x14210
movq %rax, -0xa0(%rbp)
callq 0x5070
addq $0xd0, %rsp
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x3500