Skip to content

Commit

Permalink
Add memory release and thread release
Browse files Browse the repository at this point in the history
1. Call usrsctp_finish to release the sctp thread
2. Call ssl_transport_disconnect to release the memory of g_ps.net_ctx
  • Loading branch information
topworldcoder committed Dec 11, 2024
1 parent 4df7bc3 commit cbf52ae
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/peer_signaling.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,8 @@ void peer_signaling_leave_channel() {
if (status != MQTTSuccess) {
LOGE("Failed to disconnect with broker: %s", MQTT_Status_strerror(status));
}

ssl_transport_disconnect(&g_ps.net_ctx);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/sctp.c
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ void sctp_destroy_socket(Sctp* sctp) {
if (sctp && sctp->sock) {
usrsctp_shutdown(sctp->sock, SHUT_RDWR);
usrsctp_close(sctp->sock);
usrsctp_finish();
sctp->sock = NULL;
}
#endif
Expand Down

0 comments on commit cbf52ae

Please sign in to comment.