mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
resume connection without initiating a new one
Signed-off-by: Alexandra <alexandra.bach@eonerc.rwth-aachen.de>
This commit is contained in:
parent
54796d11b2
commit
f457238f83
1 changed files with 13 additions and 2 deletions
|
@ -230,7 +230,6 @@ void PeerConnection::onConnectionStateChange(rtc::PeerConnection::State state) {
|
||||||
|
|
||||||
case rtc::PeerConnection::State::Closed: {
|
case rtc::PeerConnection::State::Closed: {
|
||||||
logger->debug("Closed peer connection");
|
logger->debug("Closed peer connection");
|
||||||
resetConnectionAndStandby(lock);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,6 +286,7 @@ void PeerConnection::onSignalingMessage(SignalingMessage msg) {
|
||||||
auto const &id = c.peerID;
|
auto const &id = c.peerID;
|
||||||
|
|
||||||
if (c.peers.size() < 2) {
|
if (c.peers.size() < 2) {
|
||||||
|
logger->debug("Ignoring control message. Not enough peers.");
|
||||||
resetConnectionAndStandby(lock);
|
resetConnectionAndStandby(lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -300,6 +300,9 @@ void PeerConnection::onSignalingMessage(SignalingMessage msg) {
|
||||||
snd = c.id;
|
snd = c.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logger->debug("Received control message: first={}, second={}, I am "
|
||||||
|
"{}",
|
||||||
|
fst, snd, id);
|
||||||
|
|
||||||
standby = (id != fst && id != snd);
|
standby = (id != fst && id != snd);
|
||||||
|
|
||||||
|
@ -309,6 +312,7 @@ void PeerConnection::onSignalingMessage(SignalingMessage msg) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger->debug("firstID={}, secondID={}", firstID, secondID);
|
||||||
if (fst == firstID && snd == secondID) {
|
if (fst == firstID && snd == secondID) {
|
||||||
logger->debug("Ignoring control message. This connection is "
|
logger->debug("Ignoring control message. This connection is "
|
||||||
"already being established.");
|
"already being established.");
|
||||||
|
@ -321,8 +325,13 @@ void PeerConnection::onSignalingMessage(SignalingMessage msg) {
|
||||||
firstID = fst;
|
firstID = fst;
|
||||||
secondID = snd;
|
secondID = snd;
|
||||||
|
|
||||||
|
logger->debug("After resetConnection: first={}, second={}, I am {}",
|
||||||
|
fst, snd, first ? "first" : "second");
|
||||||
|
|
||||||
setupPeerConnection();
|
setupPeerConnection();
|
||||||
|
|
||||||
|
logger->debug("Setup peer connection successful");
|
||||||
|
|
||||||
if (!first) {
|
if (!first) {
|
||||||
setupDataChannel();
|
setupDataChannel();
|
||||||
conn->setLocalDescription(rtc::Description::Type::Offer);
|
conn->setLocalDescription(rtc::Description::Type::Offer);
|
||||||
|
@ -341,8 +350,10 @@ void PeerConnection::onSignalingMessage(SignalingMessage msg) {
|
||||||
},
|
},
|
||||||
|
|
||||||
[&](rtc::Candidate c) {
|
[&](rtc::Candidate c) {
|
||||||
if (standby || !conn)
|
if (standby || !conn){
|
||||||
|
logger->debug("Ignoring candidate message. Not connected.");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
conn->addRemoteCandidate(c);
|
conn->addRemoteCandidate(c);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue