Skip to content

Commit

Permalink
in client_test.cpp. fix issue where client_state could diverge from t…
Browse files Browse the repository at this point in the history
…he active torrent
  • Loading branch information
arvidn committed Feb 26, 2023
1 parent 6dcb696 commit 0efd129
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/client_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,12 @@ bool handle_alert(client_state_t& client_state, lt::alert* a)

if (state_update_alert* p = alert_cast<state_update_alert>(a))
{
lt::torrent_handle const prev = client_state.view.get_active_handle();
client_state.view.update_torrents(std::move(p->status));

// when the active torrent changes, we need to clear the peers, trackers, files, etc.
if (client_state.view.get_active_handle() != prev)
client_state.clear();
return true;
}

Expand Down

0 comments on commit 0efd129

Please sign in to comment.