Skip to content

2 peers as initiator ? #37

@G-Ray

Description

@G-Ray

Disclamer: We use [email protected]. The following issue is not visible with simple-peer <= 9.0.x, only from simple-peer >= 9.1.x

Sometimes, we get 2 peers trying to connect as initiator at same time. Here are the logs:

First peer, in one tab:

my uuid: cjrrm879l0000305zxsk3el9n
index.js:118 /all {type: "connect", from: "cjrrm879l0000305zxsk3el9n"}
index.js:121 skipping self cjrrm879l0000305zxsk3el9n
index.js:118 /all {type: "connect", from: "cjrrm8b3a000030608j7zc0u4"}
index.js:136 connecting to new peer (as initiator) cjrrm8b3a000030608j7zc0u4
index.js:1062 [3f9c98c] new peer {initiator: true, channelConfig: undefined, config: {…}, stream: undefined, offerConstraints: {…}}
index.js:1062 [3f9c98c] _needsNegotiation
index.js:1062 [3f9c98c] starting batched negotiation
index.js:1062 [3f9c98c] start negotiation
index.js:118 /all {type: "connect", from: "cjrrm879l0000305zxsk3el9n"}
index.js:121 skipping self cjrrm879l0000305zxsk3el9n
index.js:1062 [3f9c98c] signalingStateChange have-local-offer
index.js:1062 [3f9c98c] createOffer success
index.js:1062 [3f9c98c] signal
index.js:1062 [3f9c98c] iceStateChange (connection: new) (gathering: gathering)
3index.js:620 started iceComplete timeout
index.js:1062 [3f9c98c] iceStateChange (connection: new) (gathering: complete)
index.js:118 /all {type: "connect", from: "cjrrm879l0000305zxsk3el9n"}
index.js:121 skipping self cjrrm879l0000305zxsk3el9n
index.js:171 signalling cjrrm8b3a000030608j7zc0u4 {type: "offer", sdp: "v=0
↵o=- 2895647361888715537 2 IN IP4 127.0.0.1
↵s…a=mid:0
↵a=sctpmap:5000 webrtc-datachannel 1024
↵"}
index.js:1062 [3f9c98c] signal()
index.js:1062 [3f9c98c] destroy (error: InvalidStateError: Failed to set remote offer sdp: Called in wrong state: kHaveLocalOffer)
index.js:83 disconnected from peer cjrrm8b3a000030608j7zc0u4 Error: InvalidStateError: Failed to set remote offer sdp: Called in wrong state: kHaveLocalOffer
at makeError (index.js:1153)
at index.js:229

Second peer, in other tab:

my uuid: cjrrm8b3a000030608j7zc0u4
index.js:118 /all Object
index.js:121 skipping self cjrrm8b3a000030608j7zc0u4
index.js:118 /all Object
index.js:136 connecting to new peer (as initiator) cjrrm879l0000305zxsk3el9n
index.js:1062 [98300c4] new peer Object
index.js:1062 [98300c4] _needsNegotiation
index.js:1062 [98300c4] starting batched negotiation
index.js:1062 [98300c4] start negotiation
index.js:171 signalling cjrrm879l0000305zxsk3el9n Object
index.js:1062 [98300c4] signal()
index.js:1062 [98300c4] destroy (error: InvalidStateError: Failed to set remote offer sdp: Called in wrong state: kHaveLocalOffer)
index.js:83 disconnected from peer cjrrm879l0000305zxsk3el9n Error: InvalidStateError: Failed to set remote offer sdp: Called in wrong state: kHaveLocalOffer
at makeError (index.js:1153)
at index.js:229
index.js:157 skipping non-offer Object
index.js:157 skipping non-offer Object
index.js:157 skipping non-offer Object
index.js:118 /all {type: "connect", from: "cjrrm879l0000305zxsk3el9n"}
index.js:136 connecting to new peer (as initiator) cjrrm879l0000305zxsk3el9n
index.js:1062 [8d5419d] new peer {initiator: true, channelConfig: undefined, config: undefined, stream: undefined, offerConstraints: {…}}
index.js:1062 [8d5419d] _needsNegotiation
index.js:1062 [8d5419d] starting batched negotiation
index.js:1062 [8d5419d] start negotiation
index.js:1062 [8d5419d] signalingStateChange have-local-offer
index.js:1062 [8d5419d] createOffer success
index.js:1062 [8d5419d] signal
index.js:1062 [8d5419d] iceStateChange (connection: new) (gathering: gathering)
3index.js:620 started iceComplete timeout
index.js:1062 [8d5419d] iceStateChange (connection: new) (gathering: complete)

We are unable to reproduce this issue in tests, but would be great if you have an idea why 2 peers could try to join as iniator at same time ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions