refactor: fix shutdown order of utp (#4331)

This commit is contained in:
Charles Kerr 2022-12-06 14:28:48 -06:00 committed by GitHub
parent 22a3a5db25
commit e06e304cc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -1214,7 +1214,6 @@ void tr_session::closeImplPart1(std::promise<void>* 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<void>* 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

View File

@ -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<tr_verify_worker> verifier_ = std::make_unique<tr_verify_worker>();
public:
struct struct_utp_context* utp_context = nullptr;
std::unique_ptr<libtransmission::Timer> utp_timer;
};