diff --git a/src/client.asm b/src/client.asm index cb1393e..c38e126 100644 --- a/src/client.asm +++ b/src/client.asm @@ -1,5 +1,5 @@ connect: - packet_packer_reset + call packet_packer_reset mov dword [peer_token], 0xFFFFFFFF mov rax, sockaddr_server diff --git a/src/packet.asm b/src/packet.asm index ea8afe4..90d530e 100644 --- a/src/packet.asm +++ b/src/packet.asm @@ -2,14 +2,14 @@ ; you can also push bytes into a packer buffer ; see packer.asm for that -%macro packet_packer_reset 0 +packet_packer_reset: mov dword [udp_payload_index], 0 mov byte [out_packet_header_flags], 0 mov byte [out_packet_header_num_chunks], 0 -%endmacro + ret -%macro hexdump_outgoing_packet 0 +hexdump_outgoing_packet: push rax push rdi @@ -25,7 +25,7 @@ pop rdi pop rax -%endmacro + ret ; packet_pack_raw [buffer] [buffer size] %macro packet_pack_raw 2 diff --git a/src/packet_packer.asm b/src/packet_packer.asm index 995aab1..514e676 100644 --- a/src/packet_packer.asm +++ b/src/packet_packer.asm @@ -85,27 +85,13 @@ send_packet6: mov edi, [udp_payload_index] add rdi, PACKET6_HEADER_LEN - ; ; dbg print - ; push rax - ; print_label s_sending_packet_with_size - ; mov rax, rdi - ; call println_uint32 - ; pop rax - - push rax - ; TODO: somehow we sent too much here - printlnf "size=%d", rdi - print "sending: " - mov rax, udp_send_buf - call print_hexdump - call print_newline - pop rax + call hexdump_outgoing_packet call send_udp ; this is for convenience so we can just queue new chunks ; and never have to worry about which chunk is the first - packet_packer_reset + call packet_packer_reset pop rdi pop rax @@ -161,7 +147,7 @@ send_packet7: ; this is for convenience so we can just queue new chunks ; and never have to worry about which chunk is the first - packet_packer_reset + call packet_packer_reset pop rdi pop rax @@ -197,6 +183,6 @@ send_packet_with_payload: ; this is for convenience so we can just queue new chunks ; and never have to worry about which chunk is the first - packet_packer_reset + call packet_packer_reset ret