git » sdk » commit 2c46f5c

Prevent double setup

author Stephen Paul Weber
2026-02-04 19:08:04 UTC
committer Stephen Paul Weber
2026-02-04 19:08:04 UTC
parent 164c69aee7ae3c094a0e8df0d94575b97f60b9fd

Prevent double setup

borogove/calls/PeerConnection.cpp.hx +9 -3

diff --git a/borogove/calls/PeerConnection.cpp.hx b/borogove/calls/PeerConnection.cpp.hx
index 4542785..920cec7 100644
--- a/borogove/calls/PeerConnection.cpp.hx
+++ b/borogove/calls/PeerConnection.cpp.hx
@@ -915,9 +915,15 @@ class PeerConnection {
 
 	public function setLocalDescription(sdpType: Null<SdpType>): Promise<Any> {
 		return new Promise((resolve, reject) -> {
-			waitingOnLocal = resolve;
-			if (!hasRemote) addPendingTracks();
-			pc.ref.setLocalDescription(sdpType ?? SdpType.UNSPEC);
+			if (hasLocal) {
+				// This prevents re-set-up when we want it, but usually we don't for now
+				// and it fixes inbound creating an offer when we want an answer
+				resolve(null);
+			} else {
+				waitingOnLocal = resolve;
+				if (!hasRemote) addPendingTracks();
+				pc.ref.setLocalDescription(sdpType ?? SdpType.UNSPEC);
+			}
 		});
 	}