Skip to content

Commit

Permalink
Merge pull request #186 from uProxy/trevj-first-signal
Browse files Browse the repository at this point in the history
add a field to signalling messages to indicate a new round of signalling messages
  • Loading branch information
trevj committed May 29, 2015
2 parents cac5676 + 933c5d3 commit e6f5146
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "uproxy-lib",
"description": "Shared libraries for uProxy projects.",
"version": "27.1.2",
"version": "27.2.0",
"repository": {
"type": "git",
"url": "https://github.com/uProxy/uproxy-lib"
Expand Down
15 changes: 14 additions & 1 deletion src/bridge/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export interface SignallingMessage {
// processing the previous message, most likely because no supported
// provider was found.
errorOnLastMessage ?:boolean;

// If present, indicates that this message is first in a round of
// signaling messages.
first ?:boolean;
}

////////
Expand Down Expand Up @@ -156,6 +160,10 @@ export class BridgingPeerConnection implements peerconnection.PeerConnection<

private provider_ :peerconnection.PeerConnection<any>;

// True until a signalling message has been sent.
// Used to set the first field in signalling messages.
private first_ = true;

// Private, use the static constructors instead.
constructor(
private preferredProviderType_ :ProviderType,
Expand Down Expand Up @@ -232,7 +240,12 @@ export class BridgingPeerConnection implements peerconnection.PeerConnection<
}

private wrapSignal_ = (signal:Object) : SignallingMessage => {
return makeSingleProviderMessage(this.providerType_, [signal]);
var message = makeSingleProviderMessage(this.providerType_, [signal]);
if (this.first_) {
message.first = true;
this.first_ = false;
}
return message;
}

// Unbatches the signals and forwards them to the current provider,
Expand Down

0 comments on commit e6f5146

Please sign in to comment.