@volter/teams 0.1.40 → 0.1.41

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.
Files changed (2) hide show
  1. package/channel.mjs +4 -4
  2. package/package.json +1 -1
package/channel.mjs CHANGED
@@ -265,8 +265,8 @@ export class Channel extends EventEmitter {
265
265
  return this;
266
266
  }
267
267
 
268
- /** Open a named stream; resolves once the peer accepts it, rejects if refused. */
269
- open(name, params = {}) {
268
+ /** Open a named stream; resolves once the peer accepts it, rejects if refused or unanswered within `timeoutMs`. */
269
+ open(name, params = {}, { timeoutMs = HANDSHAKE_TIMEOUT_MS } = {}) {
270
270
  // A closed connection refuses at once rather than waiting out the handshake bound.
271
271
  if (this.closed) return Promise.reject(new Error(`${name} refused: connection closed`));
272
272
  const id = this._nextStream;
@@ -278,8 +278,8 @@ export class Channel extends EventEmitter {
278
278
  const timer = setTimeout(() => {
279
279
  stream.off('opened', onOpened); stream.off('close', onClosed);
280
280
  this._streams.delete(id);
281
- reject(new Error(`${name} did not open within ${HANDSHAKE_TIMEOUT_MS} ms`));
282
- }, HANDSHAKE_TIMEOUT_MS);
281
+ reject(new Error(`${name} did not open within ${timeoutMs} ms`));
282
+ }, timeoutMs);
283
283
  timer.unref?.();
284
284
  const onOpened = () => { clearTimeout(timer); stream.off('close', onClosed); resolve(stream); };
285
285
  const onClosed = (reason) => { clearTimeout(timer); stream.off('opened', onOpened); reject(new Error(`${name} refused: ${reason ?? 'closed'}`)); };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/teams",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
4
4
  "type": "module",
5
5
  "description": "Volter Teams, the neutral team plane: machine identity and daemon core, the local door and server link, admission from machine grants, product doors, and the Teams server's neutral routes (company RFC 0008).",
6
6
  "license": "MIT",