Skip to content

Commit

Permalink
Prevent any state change after close in PeerConnection (Fix #600)
Browse files Browse the repository at this point in the history
  • Loading branch information
paullouisageneau committed Apr 15, 2022
1 parent 731f68a commit 8712a64
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/impl/peerconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1126,12 +1126,13 @@ bool PeerConnection::changeState(State newState) {
s << newState;
PLOG_INFO << "Changed state to " << s.str();

if (newState == State::Closed)
stateChangeCallback(State::Closed); // synchronous
else
if (newState == State::Closed) {
auto callback = std::move(stateChangeCallback); // steal the callback
callback(State::Closed); // call it synchronously
} else {
mProcessor.enqueue(&PeerConnection::trigger<State>, shared_from_this(), stateChangeCallback,
newState);

}
return true;
}

Expand Down

0 comments on commit 8712a64

Please sign in to comment.