Skip to content

Commit 2281f80

Browse files
authored
fix: do not run webrtc cleanup on transport close (#2498)
The cleanup function from `node-datachannel` closes all open peer connections/datachannels - if there are multiple transports/nodes in the same process they will all be closed.
1 parent 0d55966 commit 2281f80

File tree

4 files changed

+1
-10
lines changed

4 files changed

+1
-10
lines changed

packages/transport-webrtc/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
"test:node": "aegir test -t node --cov",
4444
"test:chrome": "aegir test -t browser --cov",
4545
"test:firefox": "aegir test -t browser -- --browser firefox",
46-
"test:electron-main": "aegir test -t electron-main",
4746
"lint": "aegir lint",
4847
"lint:fix": "aegir lint --fix",
4948
"clean": "aegir clean",

packages/transport-webrtc/src/private-to-private/transport.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { WebRTC } from '@multiformats/multiaddr-matcher'
66
import { codes } from '../error.js'
77
import { WebRTCMultiaddrConnection } from '../maconn.js'
88
import { DataChannelMuxerFactory } from '../muxer.js'
9-
import { cleanup, RTCPeerConnection } from '../webrtc/index.js'
9+
import { RTCPeerConnection } from '../webrtc/index.js'
1010
import { initiateConnection } from './initiate-connection.js'
1111
import { WebRTCPeerListener } from './listener.js'
1212
import { handleIncomingStream } from './signaling-stream-handler.js'
@@ -87,7 +87,6 @@ export class WebRTCTransport implements Transport, Startable {
8787

8888
async stop (): Promise<void> {
8989
await this.components.registrar.unhandle(SIGNALING_PROTO_ID)
90-
cleanup()
9190
this._started = false
9291
}
9392

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export const RTCPeerConnection = globalThis.RTCPeerConnection
22
export const RTCSessionDescription = globalThis.RTCSessionDescription
33
export const RTCIceCandidate = globalThis.RTCIceCandidate
4-
export function cleanup (): void {}
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
import node from 'node-datachannel'
2-
31
export { RTCSessionDescription, RTCIceCandidate, RTCPeerConnection } from 'node-datachannel/polyfill'
4-
5-
export function cleanup (): void {
6-
node.cleanup()
7-
}

0 commit comments

Comments
 (0)