mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-22 11:18:22 -05:00
Terminate torrent thread on destruction
This commit is contained in:
@@ -42,7 +42,10 @@ namespace openspace {
|
||||
|
||||
TorrentClient::TorrentClient() {}
|
||||
|
||||
TorrentClient::~TorrentClient() {}
|
||||
TorrentClient::~TorrentClient() {
|
||||
_keepRunning = false;
|
||||
_torrentThread.join();
|
||||
}
|
||||
|
||||
void TorrentClient::initialize() {
|
||||
libtorrent::settings_pack settings;
|
||||
@@ -73,7 +76,7 @@ void TorrentClient::initialize() {
|
||||
_session->start_upnp();
|
||||
|
||||
_torrentThread = std::thread([this]() {
|
||||
while (true) {
|
||||
while (_keepRunning) {
|
||||
std::vector<libtorrent::alert*> alerts;
|
||||
_session->pop_alerts(&alerts);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user