@@ -3,7 +3,6 @@ import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/i
3
3
import { abortableSource } from 'abortable-iterator'
4
4
import { pipe } from 'it-pipe'
5
5
import type { Sink , Source } from 'it-stream-types'
6
- import { trackedMap } from '@libp2p/tracked-map'
7
6
import { pushable , Pushable } from 'it-pushable'
8
7
import errcode from 'err-code'
9
8
import anySignal from 'any-signal'
@@ -15,29 +14,22 @@ import { Config, defaultConfig, verifyConfig } from './config.js'
15
14
import { Decoder } from './decode.js'
16
15
import type { Logger } from '@libp2p/logger'
17
16
import type { Uint8ArrayList } from 'uint8arraylist'
18
- import type { Metrics } from '@libp2p/interface-metrics'
19
17
20
18
const YAMUX_PROTOCOL_ID = '/yamux/1.0.0'
21
19
22
20
export interface YamuxMuxerInit extends StreamMuxerInit , Partial < Config > {
23
21
}
24
22
25
- export interface YamuxComponents {
26
- metrics ?: Metrics
27
- }
28
-
29
23
export class Yamux implements StreamMuxerFactory {
30
24
protocol = YAMUX_PROTOCOL_ID
31
- private readonly components : YamuxComponents
32
25
private readonly _init : YamuxMuxerInit
33
26
34
- constructor ( components : YamuxComponents , init : YamuxMuxerInit = { } ) {
35
- this . components = components
27
+ constructor ( init : YamuxMuxerInit = { } ) {
36
28
this . _init = init
37
29
}
38
30
39
31
createStreamMuxer ( init ?: YamuxMuxerInit ) : YamuxMuxer {
40
- return new YamuxMuxer ( this . components , {
32
+ return new YamuxMuxer ( {
41
33
...this . _init ,
42
34
...init
43
35
} )
@@ -82,7 +74,7 @@ export class YamuxMuxer implements StreamMuxer {
82
74
private readonly onIncomingStream ?: ( stream : Stream ) => void
83
75
private readonly onStreamEnd ?: ( stream : Stream ) => void
84
76
85
- constructor ( components : YamuxComponents , init : YamuxMuxerInit ) {
77
+ constructor ( init : YamuxMuxerInit ) {
86
78
this . _init = init
87
79
this . client = init . direction === 'outbound'
88
80
this . config = { ...defaultConfig , ...init }
@@ -94,7 +86,7 @@ export class YamuxMuxer implements StreamMuxer {
94
86
this . onIncomingStream = init . onIncomingStream
95
87
this . onStreamEnd = init . onStreamEnd
96
88
97
- this . _streams = trackedMap ( { metrics : components . metrics , component : 'yamux' , metric : 'streams' } )
89
+ this . _streams = new Map ( )
98
90
99
91
this . source = pushable ( {
100
92
onEnd : ( err ?: Error ) : void => {
0 commit comments