Skip to content

Commit

Permalink
Remove parameter from the onpeerconnection callback.
Browse files Browse the repository at this point in the history
The distinction is not likely to be useful, and it doesn't make
sense in all cases.
  • Loading branch information
jech committed Mar 22, 2022
1 parent 8d4bafe commit 55ae4a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
3 changes: 1 addition & 2 deletions static/galene.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,8 @@ async function gotConnected(username) {

/**
* @this {ServerConnection}
* @param {boolean} up
*/
function onPeerConnection(up) {
function onPeerConnection() {
if(!getSettings().forceRelay)
return null;
let old = this.rtcConfiguration;
Expand Down
11 changes: 5 additions & 6 deletions static/protocol.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ function ServerConnection() {
* It may either return null, or a new RTCConfiguration that overrides
* the value obtained from the server.
*
* @type{(this: ServerConnection, up: boolean) => RTCConfiguration}
* @type{(this: ServerConnection) => RTCConfiguration}
*/
this.onpeerconnection = null;
/**
Expand Down Expand Up @@ -529,12 +529,11 @@ ServerConnection.prototype.findByLocalId = function(localId) {
* with this peer connection. This usually comes from the server, but may
* be overridden by the onpeerconnection callback.
*
* @param {boolean} up
* @returns {RTCConfiguration}
*/
ServerConnection.prototype.getRTCConfiguration = function(up) {
ServerConnection.prototype.getRTCConfiguration = function() {
if(this.onpeerconnection) {
let conf = this.onpeerconnection.call(this, up);
let conf = this.onpeerconnection.call(this);
if(conf !== null)
return conf;
}
Expand All @@ -559,7 +558,7 @@ ServerConnection.prototype.newUpStream = function(localId) {
throw new Error("This browser doesn't support WebRTC");


let pc = new RTCPeerConnection(sc.getRTCConfiguration(true));
let pc = new RTCPeerConnection(sc.getRTCConfiguration());
if(!pc)
throw new Error("Couldn't create peer connection");

Expand Down Expand Up @@ -715,7 +714,7 @@ ServerConnection.prototype.gotOffer = async function(id, label, source, username
if(!c) {
let pc;
try {
pc = new RTCPeerConnection(sc.getRTCConfiguration(false));
pc = new RTCPeerConnection(sc.getRTCConfiguration());
} catch(e) {
console.error(e);
sc.send({
Expand Down

0 comments on commit 55ae4a6

Please sign in to comment.