From e06e304cc865f62f0f1439cf1e58e75fd6b606d2 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 6 Dec 2022 14:28:48 -0600 Subject: [PATCH] refactor: fix shutdown order of utp (#4331) --- libtransmission/session.cc | 2 +- libtransmission/session.h | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libtransmission/session.cc b/libtransmission/session.cc index b782857ec..054f51cc1 100644 --- a/libtransmission/session.cc +++ b/libtransmission/session.cc @@ -1214,7 +1214,6 @@ void tr_session::closeImplPart1(std::promise* closed_promise, std::chrono: // close the low-hanging fruit that can be closed immediately w/o consequences utp_timer.reset(); - tr_utpClose(this); verifier_.reset(); save_timer_.reset(); now_timer_.reset(); @@ -1244,6 +1243,7 @@ void tr_session::closeImplPart1(std::promise* closed_promise, std::chrono: tr_torrentFreeInSessionThread(tor); } torrents.clear(); + tr_utpClose(this); // ...now that all the torrents have been closed, any remaining // `&event=stopped` announce messages are queued in the announcer. // Tell the announcer to start shutdown, which sends out the stop diff --git a/libtransmission/session.h b/libtransmission/session.h index 45a69039c..52bed009c 100644 --- a/libtransmission/session.h +++ b/libtransmission/session.h @@ -1125,6 +1125,10 @@ private: AltSpeedMediator alt_speed_mediator_{ *this }; tr_session_alt_speeds alt_speeds_{ alt_speed_mediator_ }; +public: + struct struct_utp_context* utp_context = nullptr; + +private: // depends-on: open_files_ tr_torrents torrents_; @@ -1175,7 +1179,6 @@ private: std::unique_ptr verifier_ = std::make_unique(); public: - struct struct_utp_context* utp_context = nullptr; std::unique_ptr utp_timer; };