-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
Description
Background
When stopping a session while in buying mode, all connections are closed, and the session is set to stopped, however the _buyingState variable is not inspected or touched. As a reminder, it is of type
enum class BuyingState {
// Inviting sellers:
// Peers with good enough terms are invited, even when paused,
sending_invitations,
// Requesting and downloading pieces:
// Contract has been announced and exchanges are ongoing.
downloading,
// Have all pieces
download_completed
};Problem
If stopped when downloading, and then later started, then it has no way of recovering back tosending_invitations, and is effectively stuck. This analogous to this issue #5.
Solution
Reset _buyingState to sending_invitations if stopped while _buyingState == downloading.