Skip to content

Commit

Permalink
Fix: close http client in rust_g to prevent memory leak issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Bizzonium authored and Dimach committed Jul 1, 2024
1 parent 4e00c8f commit ba0e7c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/rust_g.dm
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@
#define rustg_http_request_blocking(method, url, body, headers, options) RUSTG_CALL(RUST_G, "http_request_blocking")(method, url, body, headers, options)
#define rustg_http_request_async(method, url, body, headers, options) RUSTG_CALL(RUST_G, "http_request_async")(method, url, body, headers, options)
#define rustg_http_check_request(req_id) RUSTG_CALL(RUST_G, "http_check_request")(req_id)
/proc/rustg_create_async_http_client() return RUSTG_CALL(RUST_G, "start_http_client")()
/proc/rustg_close_async_http_client() return RUSTG_CALL(RUST_G, "shutdown_http_client")()

#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET"
#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB"
Expand Down
1 change: 1 addition & 0 deletions code/game/world.dm
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ GLOBAL_VAR(restart_counter)
#endif

/world/proc/auxcleanup()
rustg_close_async_http_client() // Close the HTTP client. If you dont do this, youll get phantom threads which can crash DD from memory access violations
AUXTOOLS_FULL_SHUTDOWN(AUXLUA)
var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL")
if (debug_server)
Expand Down

0 comments on commit ba0e7c2

Please sign in to comment.