Skip to content

Commit

Permalink
CBL-1513: Don't leak internal stopping status
Browse files Browse the repository at this point in the history
If adding a new internal status, it will need to be handled here as well.
  • Loading branch information
borrrden committed Jan 6, 2021
1 parent e258843 commit 444af84
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Replicator/c4Replicator.hh
Expand Up @@ -138,7 +138,25 @@ struct C4Replicator : public RefCounted,

C4ReplicatorStatus status() {
LOCK(_mutex);
return _status;
switch (_status.level) {
// CBL-1513: Any new approved statuses must be added to this list,
// or they will be forced to busy in order to prevent internal statuses
// from leaking
case kC4Busy:
case kC4Connecting:
case kC4Idle:
case kC4Offline:
case kC4Stopped:
return _status;

default:
return {
kC4Busy,
_status.progress,
_status.error,
_status.flags
};
}
}

virtual void stop() {
Expand Down

0 comments on commit 444af84

Please sign in to comment.