File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed
Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " uproxy-lib" ,
33 "description" : " Shared libraries for uProxy projects." ,
4- "version" : " 20.1.1 " ,
4+ "version" : " 21.0.0 " ,
55 "repository" : {
66 "type" : " git" ,
77 "url" : " https://github.com/uProxy/uproxy-lib"
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ export interface PeerConnection<TSignallingMessage> {
8787 // Closing the peer connection will close all associated data channels
8888 // and set |pcState| to |DISCONNECTED| (and hence fulfills
8989 // |onceDisconnected|)
90- close : ( ) => void ;
90+ close : ( ) => Promise < void > ;
9191}
9292
9393export interface SignallingMessage {
@@ -260,25 +260,20 @@ export class PeerConnectionClass implements PeerConnection<SignallingMessage> {
260260 }
261261
262262 // Close the peer connection. This function is idempotent.
263- public close = ( ) : void => {
263+ public close = ( ) : Promise < void > => {
264264 log . info ( this . peerName_ + ': ' + 'close' ) ;
265265
266- // This may happen because calling close will invoke pc_.close, which
267- // may call |onSignallingStateChange_| with |this.pc_.signalingState ===
268- // 'closed'|.
269- if ( this . pcState === State . DISCONNECTED ) { return ; }
270-
271266 if ( this . pcState === State . CONNECTING ) {
272267 this . rejectConnected_ ( new Error ( 'close was called while connecting.' ) ) ;
273268 }
274269
275270 this . pcState = State . DISCONNECTED ;
276271 this . fulfillDisconnected_ ( ) ;
277272
278- this . pc_ . getSignalingState ( ) . then ( ( state :string ) => {
273+ return this . pc_ . getSignalingState ( ) . then ( ( state :string ) => {
279274 if ( state !== 'closed' ) {
280275 // Note is expected to invoke |onSignallingStateChange_|
281- this . pc_ . close ( ) ;
276+ return this . pc_ . close ( ) ;
282277 }
283278 } ) ;
284279 }
You can’t perform that action at this time.
0 commit comments