say goodbye to clients then close socket

This commit is contained in:
root 2025-05-07 14:20:06 +00:00
parent 1cf28e9565
commit f096cb00e7
3 changed files with 53 additions and 19 deletions

View file

@ -1,35 +0,0 @@
; Returns new array length in rax
; edi - fd
pollfds__remove:
mov r10d, edi
mov rdi, [pollfds_len]
; Variables:
; rdi - array length
; rsi - array index
; r10d - fd
; r11d - pollfds[rdi].fd
pollfds__remove__loop:
cmp rsi, rdi
jge return ; fd was not found
mov r11d, [pollfds + rsi * pollfd_size]
add rsi, 1
cmp r11d, r10d
jne pollfds__remove__loop
sub rsi, 1
; Returns new array length in rax
; rdi - array length
; rsi - array index to remove
pollfds__remove_index:
cmp rdi, 1
jle pollfds__clear
mov r10d, [pollfds + (rdi - 1) * pollfd_size]
mov [pollfds + rsi * pollfd_size], r10d
sub rdi, 1
ret
; Returns new array length in rax
pollfds__clear:
mov rax, 0
ret