Commit 55ae4a68 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Remove parameter from the onpeerconnection callback.

The distinction is not likely to be useful, and it doesn't make
sense in all cases.
parent 8d4bafe0
...@@ -327,9 +327,8 @@ async function gotConnected(username) { ...@@ -327,9 +327,8 @@ async function gotConnected(username) {
/** /**
* @this {ServerConnection} * @this {ServerConnection}
* @param {boolean} up
*/ */
function onPeerConnection(up) { function onPeerConnection() {
if(!getSettings().forceRelay) if(!getSettings().forceRelay)
return null; return null;
let old = this.rtcConfiguration; let old = this.rtcConfiguration;
......
...@@ -157,7 +157,7 @@ function ServerConnection() { ...@@ -157,7 +157,7 @@ function ServerConnection() {
* It may either return null, or a new RTCConfiguration that overrides * It may either return null, or a new RTCConfiguration that overrides
* the value obtained from the server. * the value obtained from the server.
* *
* @type{(this: ServerConnection, up: boolean) => RTCConfiguration} * @type{(this: ServerConnection) => RTCConfiguration}
*/ */
this.onpeerconnection = null; this.onpeerconnection = null;
/** /**
...@@ -529,12 +529,11 @@ ServerConnection.prototype.findByLocalId = function(localId) { ...@@ -529,12 +529,11 @@ ServerConnection.prototype.findByLocalId = function(localId) {
* with this peer connection. This usually comes from the server, but may * with this peer connection. This usually comes from the server, but may
* be overridden by the onpeerconnection callback. * be overridden by the onpeerconnection callback.
* *
* @param {boolean} up
* @returns {RTCConfiguration} * @returns {RTCConfiguration}
*/ */
ServerConnection.prototype.getRTCConfiguration = function(up) { ServerConnection.prototype.getRTCConfiguration = function() {
if(this.onpeerconnection) { if(this.onpeerconnection) {
let conf = this.onpeerconnection.call(this, up); let conf = this.onpeerconnection.call(this);
if(conf !== null) if(conf !== null)
return conf; return conf;
} }
...@@ -559,7 +558,7 @@ ServerConnection.prototype.newUpStream = function(localId) { ...@@ -559,7 +558,7 @@ ServerConnection.prototype.newUpStream = function(localId) {
throw new Error("This browser doesn't support WebRTC"); throw new Error("This browser doesn't support WebRTC");
let pc = new RTCPeerConnection(sc.getRTCConfiguration(true)); let pc = new RTCPeerConnection(sc.getRTCConfiguration());
if(!pc) if(!pc)
throw new Error("Couldn't create peer connection"); throw new Error("Couldn't create peer connection");
...@@ -715,7 +714,7 @@ ServerConnection.prototype.gotOffer = async function(id, label, source, username ...@@ -715,7 +714,7 @@ ServerConnection.prototype.gotOffer = async function(id, label, source, username
if(!c) { if(!c) {
let pc; let pc;
try { try {
pc = new RTCPeerConnection(sc.getRTCConfiguration(false)); pc = new RTCPeerConnection(sc.getRTCConfiguration());
} catch(e) { } catch(e) {
console.error(e); console.error(e);
sc.send({ sc.send({
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment