@libp2p/mplex 5.2.2 → 5.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"mplex.d.ts","sourceRoot":"","sources":["../../src/mplex.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkC,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAO5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAClF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AA0BpD,MAAM,WAAW,WAAY,SAAQ,MAAM;IACzC,oBAAoB,EAAE,MAAM,MAAM,CAAA;IAClC,UAAU,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,IAAI,CAAA;CAC3C;AAED,UAAU,oBAAqB,SAAQ,SAAS,EAAE,eAAe;CAAG;AAEpE,qBAAa,gBAAiB,YAAW,WAAW;IAC3C,QAAQ,SAAiB;IAEzB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;IACtB,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,CAAA;IAExC,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA+E;IACxG,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8D;IACtF,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;gBAElC,UAAU,EAAE,UAAU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/src/mplex.js CHANGED
@@ -7,7 +7,6 @@ import { restrictSize } from './restrict-size.js';
7
7
  import { MessageTypes, MessageTypeNames } from './message-types.js';
8
8
  import { createStream } from './stream.js';
9
9
  import { toString as uint8ArrayToString } from 'uint8arrays';
10
- import { trackedMap } from '@libp2p/tracked-map';
11
10
  import { logger } from '@libp2p/logger';
12
11
  import errCode from 'err-code';
13
12
  import { RateLimiterMemory } from 'rate-limiter-flexible';
@@ -39,11 +38,11 @@ export class MplexStreamMuxer {
39
38
  /**
40
39
  * Stream to ids map
41
40
  */
42
- initiators: trackedMap({ metrics: components.getMetrics(), component: 'mplex', metric: 'initiatorStreams' }),
41
+ initiators: new Map(),
43
42
  /**
44
43
  * Stream to ids map
45
44
  */
46
- receivers: trackedMap({ metrics: components.getMetrics(), component: 'mplex', metric: 'receiverStreams' })
45
+ receivers: new Map()
47
46
  };
48
47
  this._init = init;
49
48
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"mplex.js","sourceRoot":"","sources":["../../src/mplex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAW,MAAM,oBAAoB,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAA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E,OAAO,GAAG,WAAW,CA+N3D"}
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAGjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAS7C,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;IAC7B,IAAI,CAAC,EAAE,WAAW,GAAG,UAAU,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,wBAAgB,YAAY,CAAE,OAAO,EAAE,OAAO,GAAG,WAAW,CAmO3D"}
@@ -126,15 +126,21 @@ export function createStream(options) {
126
126
  }
127
127
  const uint8ArrayList = new Uint8ArrayList();
128
128
  for await (const data of source) {
129
- uint8ArrayList.append(data);
130
- while (uint8ArrayList.length !== 0) {
131
- if (uint8ArrayList.length <= maxMsgSize) {
132
- send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist() });
133
- uint8ArrayList.consume(uint8ArrayList.length);
134
- break;
129
+ if (data.length <= maxMsgSize) {
130
+ send({ id, type: Types.MESSAGE, data: data instanceof Uint8ArrayList ? data : new Uint8ArrayList(data) });
131
+ }
132
+ else {
133
+ uint8ArrayList.append(data);
134
+ while (uint8ArrayList.length !== 0) {
135
+ // eslint-disable-next-line max-depth
136
+ if (uint8ArrayList.length <= maxMsgSize) {
137
+ send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist() });
138
+ uint8ArrayList.consume(uint8ArrayList.length);
139
+ break;
140
+ }
141
+ send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist(0, maxMsgSize) });
142
+ uint8ArrayList.consume(maxMsgSize);
135
143
  }
136
- send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist(0, maxMsgSize) });
137
- uint8ArrayList.consume(maxMsgSize);
138
144
  }
139
145
  }
140
146
  }
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,OAAO,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAChF,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAMvC,MAAM,GAAG,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAEzC,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAC3C,MAAM,gBAAgB,GAAG,kBAAkB,CAAA;AAC3C,MAAM,cAAc,GAAG,gBAAgB,CAAA;AACvC,MAAM,eAAe,GAAG,iBAAiB,CAAA;AAWzC,MAAM,UAAU,YAAY,CAAE,OAAgB;IAC5C,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,WAAW,EAAE,UAAU,GAAG,YAAY,EAAE,GAAG,OAAO,CAAA;IAExF,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAA;IAC7C,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAA;IAC7C,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAA;IAC7C,MAAM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S;YACxD,QAAQ;SACT;QAED,QAAQ,EAAE,EAAE;QAEZ,EAAE,EAAE,UAAU;KACf,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/mplex",
3
- "version": "5.2.2",
3
+ "version": "5.2.4",
4
4
  "description": "JavaScript implementation of https://github.com/libp2p/mplex",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p-mplex#readme",
@@ -150,9 +150,9 @@
150
150
  "@libp2p/interface-connection": "^3.0.1",
151
151
  "@libp2p/interface-stream-muxer": "^2.0.0",
152
152
  "@libp2p/logger": "^2.0.0",
153
- "@libp2p/tracked-map": "^2.0.0",
154
153
  "abortable-iterator": "^4.0.2",
155
154
  "any-signal": "^3.0.0",
155
+ "benchmark": "^2.1.4",
156
156
  "err-code": "^3.0.1",
157
157
  "it-pipe": "^2.0.3",
158
158
  "it-pushable": "^3.1.0",
@@ -175,7 +175,6 @@
175
175
  "it-map": "^1.0.6",
176
176
  "p-defer": "^4.0.0",
177
177
  "random-int": "^3.0.0",
178
- "@dapplion/benchmark": "^0.2.2",
179
178
  "typescript": "^4.7.4"
180
179
  },
181
180
  "browser": {
package/src/mplex.ts CHANGED
@@ -7,7 +7,6 @@ import { restrictSize } from './restrict-size.js'
7
7
  import { MessageTypes, MessageTypeNames, Message } from './message-types.js'
8
8
  import { createStream } from './stream.js'
9
9
  import { toString as uint8ArrayToString } from 'uint8arrays'
10
- import { trackedMap } from '@libp2p/tracked-map'
11
10
  import { logger } from '@libp2p/logger'
12
11
  import errCode from 'err-code'
13
12
  import { RateLimiterMemory } from 'rate-limiter-flexible'
@@ -71,11 +70,11 @@ export class MplexStreamMuxer implements StreamMuxer {
71
70
  /**
72
71
  * Stream to ids map
73
72
  */
74
- initiators: trackedMap<number, MplexStream>({ metrics: components.getMetrics(), component: 'mplex', metric: 'initiatorStreams' }),
73
+ initiators: new Map<number, MplexStream>(),
75
74
  /**
76
75
  * Stream to ids map
77
76
  */
78
- receivers: trackedMap<number, MplexStream>({ metrics: components.getMetrics(), component: 'mplex', metric: 'receiverStreams' })
77
+ receivers: new Map<number, MplexStream>()
79
78
  }
80
79
  this._init = init
81
80
 
package/src/stream.ts CHANGED
@@ -174,17 +174,21 @@ export function createStream (options: Options): MplexStream {
174
174
  const uint8ArrayList = new Uint8ArrayList()
175
175
 
176
176
  for await (const data of source) {
177
- uint8ArrayList.append(data)
178
-
179
- while (uint8ArrayList.length !== 0) {
180
- if (uint8ArrayList.length <= maxMsgSize) {
181
- send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist() })
182
- uint8ArrayList.consume(uint8ArrayList.length)
183
- break
177
+ if (data.length <= maxMsgSize) {
178
+ send({ id, type: Types.MESSAGE, data: data instanceof Uint8ArrayList ? data : new Uint8ArrayList(data) })
179
+ } else {
180
+ uint8ArrayList.append(data)
181
+
182
+ while (uint8ArrayList.length !== 0) {
183
+ // eslint-disable-next-line max-depth
184
+ if (uint8ArrayList.length <= maxMsgSize) {
185
+ send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist() })
186
+ uint8ArrayList.consume(uint8ArrayList.length)
187
+ break
188
+ }
189
+ send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist(0, maxMsgSize) })
190
+ uint8ArrayList.consume(maxMsgSize)
184
191
  }
185
-
186
- send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist(0, maxMsgSize) })
187
- uint8ArrayList.consume(maxMsgSize)
188
192
  }
189
193
  }
190
194
  } catch (err: any) {