@libp2p/mplex 5.2.1 → 5.2.2

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":"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,CAgO3D"}
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,CA+N3D"}
@@ -133,9 +133,8 @@ export function createStream(options) {
133
133
  uint8ArrayList.consume(uint8ArrayList.length);
134
134
  break;
135
135
  }
136
- const toSend = uint8ArrayList.length - maxMsgSize;
137
- send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist(0, toSend) });
138
- uint8ArrayList.consume(toSend);
136
+ send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist(0, maxMsgSize) });
137
+ uint8ArrayList.consume(maxMsgSize);
139
138
  }
140
139
  }
141
140
  }
@@ -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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AQ,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.1",
3
+ "version": "5.2.2",
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",
package/src/stream.ts CHANGED
@@ -183,9 +183,8 @@ export function createStream (options: Options): MplexStream {
183
183
  break
184
184
  }
185
185
 
186
- const toSend = uint8ArrayList.length - maxMsgSize
187
- send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist(0, toSend) })
188
- uint8ArrayList.consume(toSend)
186
+ send({ id, type: Types.MESSAGE, data: uint8ArrayList.sublist(0, maxMsgSize) })
187
+ uint8ArrayList.consume(maxMsgSize)
189
188
  }
190
189
  }
191
190
  } catch (err: any) {