From 0b743fa0917284edc4a503009f5d04974e51054f Mon Sep 17 00:00:00 2001 From: JBYoshi <12983479+JBYoshi@users.noreply.github.com> Date: Mon, 11 Feb 2019 18:54:44 -0600 Subject: [PATCH 1/3] Fix bug where clients try to re-answer established connections. --- client/scripts/network.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/scripts/network.js b/client/scripts/network.js index afda326..d47e952 100644 --- a/client/scripts/network.js +++ b/client/scripts/network.js @@ -273,8 +273,14 @@ class RTCPeer extends Peer { if (message.sdp) { this._conn.setRemoteDescription(new RTCSessionDescription(message.sdp)) - .then( _ => this._conn.createAnswer()) - .then(d => this._onDescription(d)) + .then( _ => { + if (message.sdp.type == 'offer') { + return this._conn.createAnswer() + .then(d => this._onDescription(d)); + } else { + return null; + } + }) .catch(e => this._onError(e)); } else if (message.ice) { this._conn.addIceCandidate(new RTCIceCandidate(message.ice)); From 521473226d0111d0e26f071874cf9a40147b7a68 Mon Sep 17 00:00:00 2001 From: Marco Marinello Date: Mon, 18 Feb 2019 13:03:01 +0100 Subject: [PATCH 2/3] Python 3 alternative in readme --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index cbf4163..b8bf925 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,10 @@ ShareDrop uses WebRTC only and isn't compatible with Safari browsers. Snapdrop u # open a second shell: cd snapdrop/client + # Python 2 python -m SimpleHTTPServer + # Python 3 + python3 -m http.server ``` Now point your browser to http://localhost:8000. From cf9129618bfb77543da80cd36daa04e21951310b Mon Sep 17 00:00:00 2001 From: RobinLinus Date: Mon, 18 Feb 2019 22:19:07 +0100 Subject: [PATCH 3/3] Remove unnecessary code --- client/scripts/network.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/client/scripts/network.js b/client/scripts/network.js index d47e952..8c1ddcb 100644 --- a/client/scripts/network.js +++ b/client/scripts/network.js @@ -274,11 +274,9 @@ class RTCPeer extends Peer { if (message.sdp) { this._conn.setRemoteDescription(new RTCSessionDescription(message.sdp)) .then( _ => { - if (message.sdp.type == 'offer') { + if (message.sdp.type === 'offer') { return this._conn.createAnswer() .then(d => this._onDescription(d)); - } else { - return null; } }) .catch(e => this._onError(e)); @@ -516,4 +514,4 @@ RTCPeer.config = { credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=', username: '28224511:1379330808' }] -} \ No newline at end of file +}