Skip to content

Commit

Permalink
fix close
Browse files Browse the repository at this point in the history
  • Loading branch information
jedeoric committed Apr 22, 2024
1 parent 1179521 commit ce5446c
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/socket_close.s
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,33 @@ SOCKET_CLOSE_DEBUG=0
.import ch395_get_cmd_status
.import ch395_get_socket_status_sn
.import socket_state
.import ch395_clear_recv_buf_sn

.proc socket_close
;;@brief Close socket
;;@inputX The socket id

lda socket_state,x
cmp #SOCK_DGRAM
bne @is_not_tcp_connexion

txa
jsr ch395_tcp_disconnect_sn ; Modify Y and A in v2024.2 ch395 lib

@is_not_tcp_connexion:
lda #$00
sta socket_state,x

; Close socket

txa
; Flush buffers
pha
lda curl_current_socket
jsr ch395_clear_recv_buf_sn
; Close socket
pla
jsr ch395_close_socket_sn


rts
.endproc

0 comments on commit ce5446c

Please sign in to comment.