agent-relay 4.0.32 → 4.0.34

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 (226) hide show
  1. package/bin/agent-relay-broker-darwin-arm64 +0 -0
  2. package/bin/agent-relay-broker-darwin-x64 +0 -0
  3. package/bin/agent-relay-broker-linux-arm64 +0 -0
  4. package/bin/agent-relay-broker-linux-x64 +0 -0
  5. package/dist/index.cjs +1 -3
  6. package/dist/src/cli/commands/on/start.d.ts.map +1 -1
  7. package/dist/src/cli/commands/on/start.js +149 -111
  8. package/dist/src/cli/commands/on/start.js.map +1 -1
  9. package/dist/src/cli/commands/setup.js +2 -2
  10. package/dist/src/cli/commands/setup.js.map +1 -1
  11. package/node_modules/@agent-relay/cloud/package.json +2 -2
  12. package/node_modules/@agent-relay/config/package.json +1 -1
  13. package/node_modules/@agent-relay/hooks/package.json +4 -4
  14. package/node_modules/@agent-relay/sdk/dist/workflows/runner.d.ts.map +1 -1
  15. package/node_modules/@agent-relay/sdk/dist/workflows/runner.js +7 -5
  16. package/node_modules/@agent-relay/sdk/dist/workflows/runner.js.map +1 -1
  17. package/node_modules/@agent-relay/sdk/package.json +2 -2
  18. package/node_modules/@agent-relay/telemetry/dist/config.d.ts +1 -1
  19. package/node_modules/@agent-relay/telemetry/dist/config.d.ts.map +1 -1
  20. package/node_modules/@agent-relay/telemetry/dist/config.js +6 -3
  21. package/node_modules/@agent-relay/telemetry/dist/config.js.map +1 -1
  22. package/node_modules/@agent-relay/telemetry/package.json +1 -1
  23. package/node_modules/@agent-relay/trajectory/package.json +2 -2
  24. package/node_modules/@agent-relay/user-directory/package.json +2 -2
  25. package/node_modules/@agent-relay/utils/package.json +2 -2
  26. package/node_modules/@aws-sdk/core/dist-cjs/index.js +18 -10
  27. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +18 -10
  28. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeDeserializer.js +6 -4
  29. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/JsonShapeSerializer.js +6 -3
  30. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/experimental/SinglePassJsonShapeSerializer.js +2 -1
  31. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/query/QueryShapeSerializer.js +2 -1
  32. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/xml/XmlShapeSerializer.js +4 -2
  33. package/node_modules/@aws-sdk/core/package.json +1 -1
  34. package/node_modules/@aws-sdk/credential-provider-env/package.json +2 -2
  35. package/node_modules/@aws-sdk/credential-provider-http/package.json +2 -2
  36. package/node_modules/@aws-sdk/credential-provider-ini/package.json +9 -9
  37. package/node_modules/@aws-sdk/credential-provider-login/package.json +3 -3
  38. package/node_modules/@aws-sdk/credential-provider-node/package.json +7 -7
  39. package/node_modules/@aws-sdk/credential-provider-process/package.json +2 -2
  40. package/node_modules/@aws-sdk/credential-provider-sso/package.json +4 -4
  41. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +3 -3
  42. package/node_modules/@aws-sdk/middleware-flexible-checksums/package.json +2 -2
  43. package/node_modules/@aws-sdk/middleware-sdk-s3/package.json +2 -2
  44. package/node_modules/@aws-sdk/middleware-user-agent/package.json +2 -2
  45. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/endpoint/bdd.js +100 -0
  46. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/endpoint/endpointResolver.js +2 -2
  47. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/endpoint/bdd.js +90 -0
  48. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/endpoint/endpointResolver.js +2 -2
  49. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/endpoint/bdd.js +80 -0
  50. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/endpoint/endpointResolver.js +2 -2
  51. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/endpoint/bdd.js +80 -0
  52. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/endpoint/endpointResolver.js +2 -2
  53. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/STSClient.js +1 -0
  54. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/auth/httpAuthSchemeProvider.js +87 -5
  55. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/endpoint/bdd.js +150 -0
  56. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/endpoint/endpointResolver.js +2 -2
  57. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/runtimeConfig.js +6 -0
  58. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/runtimeConfig.shared.js +7 -0
  59. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/endpoint/bdd.js +97 -0
  60. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/endpoint/endpointResolver.js +3 -3
  61. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/bdd.js +87 -0
  62. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/endpointResolver.js +3 -3
  63. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/endpoint/bdd.js +77 -0
  64. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/endpoint/endpointResolver.js +3 -3
  65. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/endpoint/bdd.js +77 -0
  66. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/endpoint/endpointResolver.js +3 -3
  67. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/STSClient.js +1 -0
  68. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/auth/httpAuthSchemeProvider.js +88 -4
  69. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/endpoint/bdd.js +147 -0
  70. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/endpoint/endpointResolver.js +3 -3
  71. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.js +7 -1
  72. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.shared.js +8 -1
  73. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/endpoint/bdd.d.ts +2 -0
  74. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/endpoint/bdd.d.ts +2 -0
  75. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/endpoint/bdd.d.ts +2 -0
  76. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/endpoint/bdd.d.ts +2 -0
  77. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/auth/httpAuthSchemeProvider.d.ts +15 -7
  78. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/endpoint/bdd.d.ts +2 -0
  79. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.browser.d.ts +3 -2
  80. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.d.ts +10 -4
  81. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.native.d.ts +3 -2
  82. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.shared.d.ts +3 -1
  83. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/endpoint/bdd.d.ts +2 -0
  84. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/endpoint/bdd.d.ts +2 -0
  85. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/endpoint/bdd.d.ts +2 -0
  86. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/endpoint/bdd.d.ts +2 -0
  87. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/auth/httpAuthSchemeProvider.d.ts +20 -9
  88. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/endpoint/bdd.d.ts +2 -0
  89. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.browser.d.ts +11 -5
  90. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.d.ts +35 -16
  91. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.native.d.ts +11 -5
  92. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.shared.d.ts +8 -1
  93. package/node_modules/@aws-sdk/nested-clients/package.json +5 -4
  94. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +2 -2
  95. package/node_modules/@aws-sdk/token-providers/package.json +3 -3
  96. package/node_modules/@aws-sdk/util-user-agent-node/package.json +2 -2
  97. package/node_modules/@relayfile/local-mount/README.md +215 -0
  98. package/node_modules/@relayfile/local-mount/dist/auto-sync.d.ts +31 -0
  99. package/node_modules/@relayfile/local-mount/dist/auto-sync.js +466 -0
  100. package/node_modules/@relayfile/local-mount/dist/dotfiles.d.ts +18 -0
  101. package/node_modules/@relayfile/local-mount/dist/dotfiles.js +43 -0
  102. package/node_modules/@relayfile/local-mount/dist/index.d.ts +4 -0
  103. package/node_modules/@relayfile/local-mount/dist/index.js +3 -0
  104. package/node_modules/@relayfile/local-mount/dist/launch.d.ts +50 -0
  105. package/node_modules/@relayfile/local-mount/dist/launch.js +129 -0
  106. package/node_modules/@relayfile/local-mount/dist/symlink-mount.d.ts +23 -0
  107. package/{dist/src/cli/commands/on → node_modules/@relayfile/local-mount/dist}/symlink-mount.js +88 -20
  108. package/node_modules/@relayfile/local-mount/node_modules/chokidar/LICENSE +21 -0
  109. package/node_modules/@relayfile/local-mount/node_modules/chokidar/README.md +305 -0
  110. package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/handler.d.ts +90 -0
  111. package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/handler.js +629 -0
  112. package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/index.d.ts +215 -0
  113. package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/index.js +798 -0
  114. package/node_modules/@relayfile/local-mount/node_modules/chokidar/esm/package.json +1 -0
  115. package/node_modules/@relayfile/local-mount/node_modules/chokidar/handler.d.ts +90 -0
  116. package/node_modules/@relayfile/local-mount/node_modules/chokidar/handler.js +635 -0
  117. package/node_modules/@relayfile/local-mount/node_modules/chokidar/index.d.ts +215 -0
  118. package/node_modules/@relayfile/local-mount/node_modules/chokidar/index.js +804 -0
  119. package/node_modules/@relayfile/local-mount/node_modules/chokidar/package.json +69 -0
  120. package/node_modules/@relayfile/local-mount/node_modules/readdirp/LICENSE +21 -0
  121. package/node_modules/@relayfile/local-mount/node_modules/readdirp/README.md +120 -0
  122. package/node_modules/@relayfile/local-mount/node_modules/readdirp/esm/index.d.ts +108 -0
  123. package/node_modules/@relayfile/local-mount/node_modules/readdirp/esm/index.js +257 -0
  124. package/node_modules/@relayfile/local-mount/node_modules/readdirp/esm/package.json +1 -0
  125. package/node_modules/@relayfile/local-mount/node_modules/readdirp/index.d.ts +108 -0
  126. package/node_modules/@relayfile/local-mount/node_modules/readdirp/index.js +263 -0
  127. package/node_modules/@relayfile/local-mount/node_modules/readdirp/package.json +70 -0
  128. package/node_modules/@relayfile/local-mount/package.json +47 -0
  129. package/node_modules/@smithy/config-resolver/package.json +2 -2
  130. package/node_modules/@smithy/core/dist-cjs/index.js +2 -1
  131. package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +32 -14
  132. package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +2 -2
  133. package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +16 -8
  134. package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +17 -10
  135. package/node_modules/@smithy/core/dist-cjs/submodules/schema/index.js +6 -1
  136. package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +6 -3
  137. package/node_modules/@smithy/core/dist-cjs/util-identity-and-auth/DefaultIdentityProviderConfig.js +2 -1
  138. package/node_modules/@smithy/core/dist-es/submodules/cbor/CborCodec.js +23 -11
  139. package/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +9 -3
  140. package/node_modules/@smithy/core/dist-es/submodules/endpoints/toEndpointV1.js +2 -2
  141. package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +16 -8
  142. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +9 -4
  143. package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +8 -6
  144. package/node_modules/@smithy/core/dist-es/submodules/schema/TypeRegistry.js +6 -1
  145. package/node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js +6 -3
  146. package/node_modules/@smithy/core/dist-es/util-identity-and-auth/DefaultIdentityProviderConfig.js +2 -1
  147. package/node_modules/@smithy/core/dist-types/submodules/schema/TypeRegistry.d.ts +1 -1
  148. package/node_modules/@smithy/core/package.json +2 -2
  149. package/node_modules/@smithy/middleware-endpoint/package.json +3 -3
  150. package/node_modules/@smithy/middleware-retry/package.json +5 -5
  151. package/node_modules/@smithy/middleware-serde/package.json +2 -2
  152. package/node_modules/@smithy/node-http-handler/dist-cjs/index.js +188 -93
  153. package/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js +45 -0
  154. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +71 -35
  155. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +32 -18
  156. package/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +41 -40
  157. package/node_modules/@smithy/node-http-handler/dist-types/http2/ClientHttp2SessionRef.d.ts +42 -0
  158. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +34 -14
  159. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +32 -8
  160. package/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +0 -5
  161. package/node_modules/@smithy/node-http-handler/package.json +1 -1
  162. package/node_modules/@smithy/service-error-classification/dist-cjs/index.js +5 -0
  163. package/node_modules/@smithy/service-error-classification/dist-es/index.js +4 -0
  164. package/node_modules/@smithy/service-error-classification/dist-types/index.d.ts +6 -0
  165. package/node_modules/@smithy/service-error-classification/package.json +1 -1
  166. package/node_modules/@smithy/smithy-client/package.json +4 -4
  167. package/node_modules/@smithy/util-defaults-mode-browser/package.json +2 -2
  168. package/node_modules/@smithy/util-defaults-mode-node/package.json +3 -3
  169. package/node_modules/@smithy/util-endpoints/dist-cjs/index.js +65 -53
  170. package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateCondition.js +9 -7
  171. package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateConditions.js +12 -8
  172. package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateEndpointRule.js +14 -13
  173. package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateErrorRule.js +7 -4
  174. package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateExpression.js +10 -8
  175. package/node_modules/@smithy/util-endpoints/dist-es/utils/evaluateRules.js +4 -4
  176. package/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointHeaders.js +5 -5
  177. package/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperties.js +4 -4
  178. package/node_modules/@smithy/util-endpoints/dist-types/types/shared.d.ts +3 -3
  179. package/node_modules/@smithy/util-endpoints/dist-types/utils/endpointFunctions.d.ts +2 -15
  180. package/node_modules/@smithy/util-endpoints/dist-types/utils/evaluateCondition.d.ts +6 -3
  181. package/node_modules/@smithy/util-endpoints/dist-types/utils/evaluateConditions.d.ts +3 -3
  182. package/node_modules/@smithy/util-endpoints/dist-types/utils/getEndpointHeaders.d.ts +1 -1
  183. package/node_modules/@smithy/util-endpoints/dist-types/utils/getEndpointProperties.d.ts +2 -2
  184. package/node_modules/@smithy/util-endpoints/dist-types/utils/getReferenceValue.d.ts +2 -2
  185. package/node_modules/@smithy/util-endpoints/package.json +1 -1
  186. package/node_modules/@smithy/util-retry/package.json +2 -2
  187. package/node_modules/@smithy/util-stream/package.json +2 -2
  188. package/package.json +25 -11
  189. package/packages/cloud/package.json +2 -2
  190. package/packages/config/package.json +1 -1
  191. package/packages/hooks/package.json +4 -4
  192. package/packages/sdk/dist/workflows/runner.d.ts.map +1 -1
  193. package/packages/sdk/dist/workflows/runner.js +7 -5
  194. package/packages/sdk/dist/workflows/runner.js.map +1 -1
  195. package/packages/sdk/package.json +2 -2
  196. package/packages/telemetry/dist/config.d.ts +1 -1
  197. package/packages/telemetry/dist/config.d.ts.map +1 -1
  198. package/packages/telemetry/dist/config.js +6 -3
  199. package/packages/telemetry/dist/config.js.map +1 -1
  200. package/packages/telemetry/package.json +1 -1
  201. package/packages/trajectory/package.json +2 -2
  202. package/packages/user-directory/package.json +2 -2
  203. package/packages/utils/package.json +2 -2
  204. package/dist/src/cli/commands/on/symlink-mount.d.ts +0 -12
  205. package/dist/src/cli/commands/on/symlink-mount.d.ts.map +0 -1
  206. package/dist/src/cli/commands/on/symlink-mount.js.map +0 -1
  207. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/endpoint/ruleset.js +0 -146
  208. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/endpoint/ruleset.js +0 -133
  209. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/endpoint/ruleset.js +0 -106
  210. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/endpoint/ruleset.js +0 -106
  211. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/endpoint/ruleset.js +0 -145
  212. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/endpoint/ruleset.js +0 -143
  213. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/ruleset.js +0 -130
  214. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/endpoint/ruleset.js +0 -103
  215. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/endpoint/ruleset.js +0 -103
  216. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/endpoint/ruleset.js +0 -142
  217. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/endpoint/ruleset.d.ts +0 -2
  218. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/endpoint/ruleset.d.ts +0 -2
  219. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/endpoint/ruleset.d.ts +0 -2
  220. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/endpoint/ruleset.d.ts +0 -2
  221. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/endpoint/ruleset.d.ts +0 -2
  222. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/endpoint/ruleset.d.ts +0 -2
  223. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/endpoint/ruleset.d.ts +0 -2
  224. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/endpoint/ruleset.d.ts +0 -2
  225. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/endpoint/ruleset.d.ts +0 -2
  226. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/endpoint/ruleset.d.ts +0 -2
@@ -425,58 +425,119 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
425
425
  }
426
426
  }
427
427
 
428
+ const ids = new Uint16Array(1);
429
+ class ClientHttp2SessionRef {
430
+ id = ids[0]++;
431
+ total = 0;
432
+ max = 0;
433
+ session;
434
+ refs = 0;
435
+ constructor(session) {
436
+ session.unref();
437
+ this.session = session;
438
+ }
439
+ retain() {
440
+ if (this.session.destroyed) {
441
+ throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");
442
+ }
443
+ this.refs += 1;
444
+ this.total += 1;
445
+ this.max = Math.max(this.refs, this.max);
446
+ this.session.ref();
447
+ }
448
+ free() {
449
+ if (this.session.destroyed) {
450
+ return;
451
+ }
452
+ this.refs -= 1;
453
+ if (this.refs === 0) {
454
+ this.session.unref();
455
+ }
456
+ if (this.refs < 0) {
457
+ throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.");
458
+ }
459
+ }
460
+ deref() {
461
+ return this.session;
462
+ }
463
+ destroy() {
464
+ this.refs = 0;
465
+ if (!this.session.destroyed) {
466
+ this.session.destroy();
467
+ }
468
+ }
469
+ useCount() {
470
+ return this.refs;
471
+ }
472
+ }
473
+
428
474
  class NodeHttp2ConnectionPool {
429
475
  sessions = [];
476
+ maxConcurrency = 0;
430
477
  constructor(sessions) {
431
- this.sessions = sessions ?? [];
478
+ this.sessions = (sessions ?? []).map((session) => new ClientHttp2SessionRef(session));
432
479
  }
433
480
  poll() {
434
- if (this.sessions.length > 0) {
435
- return this.sessions.shift();
481
+ let cleanup = false;
482
+ for (const session of this.sessions) {
483
+ if (session.deref().destroyed) {
484
+ cleanup = true;
485
+ continue;
486
+ }
487
+ if (!this.maxConcurrency || session.useCount() < this.maxConcurrency) {
488
+ return session;
489
+ }
490
+ }
491
+ if (cleanup) {
492
+ for (const session of this.sessions) {
493
+ if (session.deref().destroyed) {
494
+ this.remove(session);
495
+ }
496
+ }
436
497
  }
437
498
  }
438
- offerLast(session) {
439
- this.sessions.push(session);
440
- }
441
- contains(session) {
442
- return this.sessions.includes(session);
499
+ offerLast(ref) {
500
+ this.sessions.push(ref);
443
501
  }
444
- remove(session) {
445
- this.sessions = this.sessions.filter((s) => s !== session);
502
+ remove(ref) {
503
+ const ix = this.sessions.indexOf(ref);
504
+ if (ix > -1) {
505
+ this.sessions.splice(ix, 1);
506
+ }
446
507
  }
447
508
  [Symbol.iterator]() {
448
509
  return this.sessions[Symbol.iterator]();
449
510
  }
450
- destroy(connection) {
451
- for (const session of this.sessions) {
452
- if (session === connection) {
453
- if (!session.destroyed) {
454
- session.destroy();
455
- }
456
- }
457
- }
511
+ setMaxConcurrency(maxConcurrency) {
512
+ this.maxConcurrency = maxConcurrency;
513
+ }
514
+ destroy(ref) {
515
+ this.remove(ref);
516
+ ref.destroy();
458
517
  }
459
518
  }
460
519
 
461
520
  class NodeHttp2ConnectionManager {
521
+ config;
522
+ connectionPools = new Map();
462
523
  constructor(config) {
463
524
  this.config = config;
464
525
  if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) {
465
526
  throw new RangeError("maxConcurrency must be greater than zero.");
466
527
  }
467
528
  }
468
- config;
469
- sessionCache = new Map();
470
529
  lease(requestContext, connectionConfiguration) {
471
530
  const url = this.getUrlString(requestContext);
472
- const existingPool = this.sessionCache.get(url);
473
- if (existingPool) {
474
- const existingSession = existingPool.poll();
475
- if (existingSession && !this.config.disableConcurrency && !connectionConfiguration.isEventStream) {
476
- return existingSession;
531
+ const pool = this.getPool(url);
532
+ if (!this.config.disableConcurrency && !connectionConfiguration.isEventStream) {
533
+ const available = pool.poll();
534
+ if (available) {
535
+ available.retain();
536
+ return available;
477
537
  }
478
538
  }
479
- const session = http2.connect(url);
539
+ const ref = new ClientHttp2SessionRef(http2.connect(url));
540
+ const session = ref.deref();
480
541
  if (this.config.maxConcurrency) {
481
542
  session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => {
482
543
  if (err) {
@@ -487,47 +548,48 @@ class NodeHttp2ConnectionManager {
487
548
  }
488
549
  });
489
550
  }
490
- session.unref();
491
551
  const destroySessionCb = () => {
492
552
  session.destroy();
493
- this.deleteSession(url, session);
553
+ this.removeFromPool(url, ref);
494
554
  };
495
555
  session.on("goaway", destroySessionCb);
496
556
  session.on("error", destroySessionCb);
497
557
  session.on("frameError", destroySessionCb);
498
- session.on("close", () => this.deleteSession(url, session));
558
+ session.on("close", () => this.removeFromPool(url, ref));
499
559
  if (connectionConfiguration.requestTimeout) {
500
560
  session.setTimeout(connectionConfiguration.requestTimeout, destroySessionCb);
501
561
  }
502
- const connectionPool = this.sessionCache.get(url) || new NodeHttp2ConnectionPool();
503
- connectionPool.offerLast(session);
504
- this.sessionCache.set(url, connectionPool);
505
- return session;
562
+ pool.offerLast(ref);
563
+ ref.retain();
564
+ return ref;
506
565
  }
507
- deleteSession(authority, session) {
508
- const existingConnectionPool = this.sessionCache.get(authority);
509
- if (!existingConnectionPool) {
510
- return;
511
- }
512
- if (!existingConnectionPool.contains(session)) {
513
- return;
514
- }
515
- existingConnectionPool.remove(session);
516
- this.sessionCache.set(authority, existingConnectionPool);
566
+ release(_requestContext, ref) {
567
+ ref.free();
517
568
  }
518
- release(requestContext, session) {
519
- const cacheKey = this.getUrlString(requestContext);
520
- this.sessionCache.get(cacheKey)?.offerLast(session);
569
+ createIsolatedSession(requestContext, connectionConfiguration) {
570
+ const url = this.getUrlString(requestContext);
571
+ const ref = new ClientHttp2SessionRef(http2.connect(url));
572
+ const session = ref.deref();
573
+ session.settings({ maxConcurrentStreams: 1 });
574
+ const destroySession = () => {
575
+ session.destroy();
576
+ };
577
+ session.on("goaway", destroySession);
578
+ session.on("error", destroySession);
579
+ session.on("frameError", destroySession);
580
+ session.on("close", destroySession);
581
+ if (connectionConfiguration.requestTimeout) {
582
+ session.setTimeout(connectionConfiguration.requestTimeout, destroySession);
583
+ }
584
+ ref.retain();
585
+ return ref;
521
586
  }
522
587
  destroy() {
523
- for (const [key, connectionPool] of this.sessionCache) {
524
- for (const session of connectionPool) {
525
- if (!session.destroyed) {
526
- session.destroy();
527
- }
528
- connectionPool.remove(session);
588
+ for (const [url, connectionPool] of this.connectionPools) {
589
+ for (const session of [...connectionPool]) {
590
+ session.destroy();
529
591
  }
530
- this.sessionCache.delete(key);
592
+ this.connectionPools.delete(url);
531
593
  }
532
594
  }
533
595
  setMaxConcurrentStreams(maxConcurrentStreams) {
@@ -535,10 +597,42 @@ class NodeHttp2ConnectionManager {
535
597
  throw new RangeError("maxConcurrentStreams must be greater than zero.");
536
598
  }
537
599
  this.config.maxConcurrency = maxConcurrentStreams;
600
+ for (const pool of this.connectionPools.values()) {
601
+ pool.setMaxConcurrency(maxConcurrentStreams);
602
+ }
538
603
  }
539
604
  setDisableConcurrentStreams(disableConcurrentStreams) {
540
605
  this.config.disableConcurrency = disableConcurrentStreams;
541
606
  }
607
+ debug() {
608
+ const pools = {};
609
+ for (const [url, pool] of this.connectionPools) {
610
+ const sessions = [];
611
+ for (const ref of pool) {
612
+ sessions.push({
613
+ id: ref.id,
614
+ active: ref.useCount(),
615
+ maxConcurrent: ref.max,
616
+ totalRequests: ref.total,
617
+ });
618
+ }
619
+ pools[url] = { sessions };
620
+ }
621
+ return pools;
622
+ }
623
+ removeFromPool(authority, ref) {
624
+ this.connectionPools.get(authority)?.remove(ref);
625
+ }
626
+ getPool(url) {
627
+ if (!this.connectionPools.has(url)) {
628
+ const pool = new NodeHttp2ConnectionPool();
629
+ if (this.config.maxConcurrency) {
630
+ pool.setMaxConcurrency(this.config.maxConcurrency);
631
+ }
632
+ this.connectionPools.set(url, pool);
633
+ }
634
+ return this.connectionPools.get(url);
635
+ }
542
636
  getUrlString(request) {
543
637
  return request.destination.toString();
544
638
  }
@@ -575,12 +669,14 @@ class NodeHttp2Handler {
575
669
  async handle(request, { abortSignal, requestTimeout, isEventStream } = {}) {
576
670
  if (!this.config) {
577
671
  this.config = await this.configProvider;
578
- this.connectionManager.setDisableConcurrentStreams(this.config.disableConcurrentStreams ?? false);
579
- if (this.config.maxConcurrentStreams) {
580
- this.connectionManager.setMaxConcurrentStreams(this.config.maxConcurrentStreams);
672
+ const { disableConcurrentStreams, maxConcurrentStreams } = this.config;
673
+ this.connectionManager.setDisableConcurrentStreams(disableConcurrentStreams ?? false);
674
+ if (maxConcurrentStreams) {
675
+ this.connectionManager.setMaxConcurrentStreams(maxConcurrentStreams);
581
676
  }
582
677
  }
583
678
  const { requestTimeout: configRequestTimeout, disableConcurrentStreams } = this.config;
679
+ const useIsolatedSession = disableConcurrentStreams || isEventStream;
584
680
  const effectiveRequestTimeout = requestTimeout ?? configRequestTimeout;
585
681
  return new Promise((_resolve, _reject) => {
586
682
  let fulfilled = false;
@@ -608,13 +704,17 @@ class NodeHttp2Handler {
608
704
  }
609
705
  const authority = `${protocol}//${auth}${hostname}${port ? `:${port}` : ""}`;
610
706
  const requestContext = { destination: new URL(authority) };
611
- const session = this.connectionManager.lease(requestContext, {
707
+ const connectConfig = {
612
708
  requestTimeout: this.config?.sessionTimeout,
613
709
  isEventStream,
614
- });
710
+ };
711
+ const ref = useIsolatedSession
712
+ ? this.connectionManager.createIsolatedSession(requestContext, connectConfig)
713
+ : this.connectionManager.lease(requestContext, connectConfig);
714
+ const session = ref.deref();
615
715
  const rejectWithDestroy = (err) => {
616
- if (disableConcurrentStreams) {
617
- this.destroySession(session);
716
+ if (useIsolatedSession) {
717
+ ref.destroy();
618
718
  }
619
719
  fulfilled = true;
620
720
  reject(err);
@@ -627,28 +727,14 @@ class NodeHttp2Handler {
627
727
  if (request.fragment) {
628
728
  path += `#${request.fragment}`;
629
729
  }
630
- const req = session.request({
730
+ const clientHttp2Stream = session.request({
631
731
  ...request.headers,
632
732
  [http2.constants.HTTP2_HEADER_PATH]: path,
633
733
  [http2.constants.HTTP2_HEADER_METHOD]: method,
634
734
  });
635
- session.ref();
636
- req.on("response", (headers) => {
637
- const httpResponse = new protocolHttp.HttpResponse({
638
- statusCode: headers[":status"] ?? -1,
639
- headers: getTransformedHeaders(headers),
640
- body: req,
641
- });
642
- fulfilled = true;
643
- resolve({ response: httpResponse });
644
- if (disableConcurrentStreams) {
645
- session.close();
646
- this.connectionManager.deleteSession(authority, session);
647
- }
648
- });
649
735
  if (effectiveRequestTimeout) {
650
- req.setTimeout(effectiveRequestTimeout, () => {
651
- req.close();
736
+ clientHttp2Stream.setTimeout(effectiveRequestTimeout, () => {
737
+ clientHttp2Stream.close();
652
738
  const timeoutError = new Error(`Stream timed out because of no activity for ${effectiveRequestTimeout} ms`);
653
739
  timeoutError.name = "TimeoutError";
654
740
  rejectWithDestroy(timeoutError);
@@ -656,36 +742,50 @@ class NodeHttp2Handler {
656
742
  }
657
743
  if (abortSignal) {
658
744
  const onAbort = () => {
659
- req.close();
745
+ clientHttp2Stream.close();
660
746
  const abortError = buildAbortError(abortSignal);
661
747
  rejectWithDestroy(abortError);
662
748
  };
663
749
  if (typeof abortSignal.addEventListener === "function") {
664
750
  const signal = abortSignal;
665
751
  signal.addEventListener("abort", onAbort, { once: true });
666
- req.once("close", () => signal.removeEventListener("abort", onAbort));
752
+ clientHttp2Stream.once("close", () => signal.removeEventListener("abort", onAbort));
667
753
  }
668
754
  else {
669
755
  abortSignal.onabort = onAbort;
670
756
  }
671
757
  }
672
- req.on("frameError", (type, code, id) => {
758
+ clientHttp2Stream.on("frameError", (type, code, id) => {
673
759
  rejectWithDestroy(new Error(`Frame type id ${type} in stream id ${id} has failed with code ${code}.`));
674
760
  });
675
- req.on("error", rejectWithDestroy);
676
- req.on("aborted", () => {
677
- rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${req.rstCode}.`));
761
+ clientHttp2Stream.on("error", rejectWithDestroy);
762
+ clientHttp2Stream.on("aborted", () => {
763
+ rejectWithDestroy(new Error(`HTTP/2 stream is abnormally aborted in mid-communication with result code ${clientHttp2Stream.rstCode}.`));
678
764
  });
679
- req.on("close", () => {
680
- session.unref();
681
- if (disableConcurrentStreams) {
682
- session.destroy();
765
+ clientHttp2Stream.on("response", (headers) => {
766
+ const httpResponse = new protocolHttp.HttpResponse({
767
+ statusCode: headers[":status"] ?? -1,
768
+ headers: getTransformedHeaders(headers),
769
+ body: clientHttp2Stream,
770
+ });
771
+ fulfilled = true;
772
+ resolve({ response: httpResponse });
773
+ if (useIsolatedSession) {
774
+ session.close();
775
+ }
776
+ });
777
+ clientHttp2Stream.on("close", () => {
778
+ if (useIsolatedSession) {
779
+ ref.destroy();
780
+ }
781
+ else {
782
+ this.connectionManager.release(requestContext, ref);
683
783
  }
684
784
  if (!fulfilled) {
685
785
  rejectWithDestroy(new Error("Unexpected error: http2 request did not get a response"));
686
786
  }
687
787
  });
688
- writeRequestBodyPromise = writeRequestBody(req, request, effectiveRequestTimeout);
788
+ writeRequestBodyPromise = writeRequestBody(clientHttp2Stream, request, effectiveRequestTimeout);
689
789
  });
690
790
  }
691
791
  updateHttpClientConfig(key, value) {
@@ -700,11 +800,6 @@ class NodeHttp2Handler {
700
800
  httpHandlerConfigs() {
701
801
  return this.config ?? {};
702
802
  }
703
- destroySession(session) {
704
- if (!session.destroyed) {
705
- session.destroy();
706
- }
707
- }
708
803
  }
709
804
 
710
805
  class Collector extends node_stream.Writable {
@@ -0,0 +1,45 @@
1
+ const ids = new Uint16Array(1);
2
+ export class ClientHttp2SessionRef {
3
+ id = ids[0]++;
4
+ total = 0;
5
+ max = 0;
6
+ session;
7
+ refs = 0;
8
+ constructor(session) {
9
+ session.unref();
10
+ this.session = session;
11
+ }
12
+ retain() {
13
+ if (this.session.destroyed) {
14
+ throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");
15
+ }
16
+ this.refs += 1;
17
+ this.total += 1;
18
+ this.max = Math.max(this.refs, this.max);
19
+ this.session.ref();
20
+ }
21
+ free() {
22
+ if (this.session.destroyed) {
23
+ return;
24
+ }
25
+ this.refs -= 1;
26
+ if (this.refs === 0) {
27
+ this.session.unref();
28
+ }
29
+ if (this.refs < 0) {
30
+ throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.");
31
+ }
32
+ }
33
+ deref() {
34
+ return this.session;
35
+ }
36
+ destroy() {
37
+ this.refs = 0;
38
+ if (!this.session.destroyed) {
39
+ this.session.destroy();
40
+ }
41
+ }
42
+ useCount() {
43
+ return this.refs;
44
+ }
45
+ }
@@ -1,24 +1,27 @@
1
1
  import http2 from "node:http2";
2
+ import { ClientHttp2SessionRef } from "./http2/ClientHttp2SessionRef";
2
3
  import { NodeHttp2ConnectionPool } from "./node-http2-connection-pool";
3
4
  export class NodeHttp2ConnectionManager {
5
+ config;
6
+ connectionPools = new Map();
4
7
  constructor(config) {
5
8
  this.config = config;
6
9
  if (this.config.maxConcurrency && this.config.maxConcurrency <= 0) {
7
10
  throw new RangeError("maxConcurrency must be greater than zero.");
8
11
  }
9
12
  }
10
- config;
11
- sessionCache = new Map();
12
13
  lease(requestContext, connectionConfiguration) {
13
14
  const url = this.getUrlString(requestContext);
14
- const existingPool = this.sessionCache.get(url);
15
- if (existingPool) {
16
- const existingSession = existingPool.poll();
17
- if (existingSession && !this.config.disableConcurrency && !connectionConfiguration.isEventStream) {
18
- return existingSession;
15
+ const pool = this.getPool(url);
16
+ if (!this.config.disableConcurrency && !connectionConfiguration.isEventStream) {
17
+ const available = pool.poll();
18
+ if (available) {
19
+ available.retain();
20
+ return available;
19
21
  }
20
22
  }
21
- const session = http2.connect(url);
23
+ const ref = new ClientHttp2SessionRef(http2.connect(url));
24
+ const session = ref.deref();
22
25
  if (this.config.maxConcurrency) {
23
26
  session.settings({ maxConcurrentStreams: this.config.maxConcurrency }, (err) => {
24
27
  if (err) {
@@ -29,47 +32,48 @@ export class NodeHttp2ConnectionManager {
29
32
  }
30
33
  });
31
34
  }
32
- session.unref();
33
35
  const destroySessionCb = () => {
34
36
  session.destroy();
35
- this.deleteSession(url, session);
37
+ this.removeFromPool(url, ref);
36
38
  };
37
39
  session.on("goaway", destroySessionCb);
38
40
  session.on("error", destroySessionCb);
39
41
  session.on("frameError", destroySessionCb);
40
- session.on("close", () => this.deleteSession(url, session));
42
+ session.on("close", () => this.removeFromPool(url, ref));
41
43
  if (connectionConfiguration.requestTimeout) {
42
44
  session.setTimeout(connectionConfiguration.requestTimeout, destroySessionCb);
43
45
  }
44
- const connectionPool = this.sessionCache.get(url) || new NodeHttp2ConnectionPool();
45
- connectionPool.offerLast(session);
46
- this.sessionCache.set(url, connectionPool);
47
- return session;
46
+ pool.offerLast(ref);
47
+ ref.retain();
48
+ return ref;
48
49
  }
49
- deleteSession(authority, session) {
50
- const existingConnectionPool = this.sessionCache.get(authority);
51
- if (!existingConnectionPool) {
52
- return;
53
- }
54
- if (!existingConnectionPool.contains(session)) {
55
- return;
56
- }
57
- existingConnectionPool.remove(session);
58
- this.sessionCache.set(authority, existingConnectionPool);
50
+ release(_requestContext, ref) {
51
+ ref.free();
59
52
  }
60
- release(requestContext, session) {
61
- const cacheKey = this.getUrlString(requestContext);
62
- this.sessionCache.get(cacheKey)?.offerLast(session);
53
+ createIsolatedSession(requestContext, connectionConfiguration) {
54
+ const url = this.getUrlString(requestContext);
55
+ const ref = new ClientHttp2SessionRef(http2.connect(url));
56
+ const session = ref.deref();
57
+ session.settings({ maxConcurrentStreams: 1 });
58
+ const destroySession = () => {
59
+ session.destroy();
60
+ };
61
+ session.on("goaway", destroySession);
62
+ session.on("error", destroySession);
63
+ session.on("frameError", destroySession);
64
+ session.on("close", destroySession);
65
+ if (connectionConfiguration.requestTimeout) {
66
+ session.setTimeout(connectionConfiguration.requestTimeout, destroySession);
67
+ }
68
+ ref.retain();
69
+ return ref;
63
70
  }
64
71
  destroy() {
65
- for (const [key, connectionPool] of this.sessionCache) {
66
- for (const session of connectionPool) {
67
- if (!session.destroyed) {
68
- session.destroy();
69
- }
70
- connectionPool.remove(session);
72
+ for (const [url, connectionPool] of this.connectionPools) {
73
+ for (const session of [...connectionPool]) {
74
+ session.destroy();
71
75
  }
72
- this.sessionCache.delete(key);
76
+ this.connectionPools.delete(url);
73
77
  }
74
78
  }
75
79
  setMaxConcurrentStreams(maxConcurrentStreams) {
@@ -77,10 +81,42 @@ export class NodeHttp2ConnectionManager {
77
81
  throw new RangeError("maxConcurrentStreams must be greater than zero.");
78
82
  }
79
83
  this.config.maxConcurrency = maxConcurrentStreams;
84
+ for (const pool of this.connectionPools.values()) {
85
+ pool.setMaxConcurrency(maxConcurrentStreams);
86
+ }
80
87
  }
81
88
  setDisableConcurrentStreams(disableConcurrentStreams) {
82
89
  this.config.disableConcurrency = disableConcurrentStreams;
83
90
  }
91
+ debug() {
92
+ const pools = {};
93
+ for (const [url, pool] of this.connectionPools) {
94
+ const sessions = [];
95
+ for (const ref of pool) {
96
+ sessions.push({
97
+ id: ref.id,
98
+ active: ref.useCount(),
99
+ maxConcurrent: ref.max,
100
+ totalRequests: ref.total,
101
+ });
102
+ }
103
+ pools[url] = { sessions };
104
+ }
105
+ return pools;
106
+ }
107
+ removeFromPool(authority, ref) {
108
+ this.connectionPools.get(authority)?.remove(ref);
109
+ }
110
+ getPool(url) {
111
+ if (!this.connectionPools.has(url)) {
112
+ const pool = new NodeHttp2ConnectionPool();
113
+ if (this.config.maxConcurrency) {
114
+ pool.setMaxConcurrency(this.config.maxConcurrency);
115
+ }
116
+ this.connectionPools.set(url, pool);
117
+ }
118
+ return this.connectionPools.get(url);
119
+ }
84
120
  getUrlString(request) {
85
121
  return request.destination.toString();
86
122
  }
@@ -1,32 +1,46 @@
1
+ import { ClientHttp2SessionRef } from "./http2/ClientHttp2SessionRef";
1
2
  export class NodeHttp2ConnectionPool {
2
3
  sessions = [];
4
+ maxConcurrency = 0;
3
5
  constructor(sessions) {
4
- this.sessions = sessions ?? [];
6
+ this.sessions = (sessions ?? []).map((session) => new ClientHttp2SessionRef(session));
5
7
  }
6
8
  poll() {
7
- if (this.sessions.length > 0) {
8
- return this.sessions.shift();
9
+ let cleanup = false;
10
+ for (const session of this.sessions) {
11
+ if (session.deref().destroyed) {
12
+ cleanup = true;
13
+ continue;
14
+ }
15
+ if (!this.maxConcurrency || session.useCount() < this.maxConcurrency) {
16
+ return session;
17
+ }
18
+ }
19
+ if (cleanup) {
20
+ for (const session of this.sessions) {
21
+ if (session.deref().destroyed) {
22
+ this.remove(session);
23
+ }
24
+ }
9
25
  }
10
26
  }
11
- offerLast(session) {
12
- this.sessions.push(session);
13
- }
14
- contains(session) {
15
- return this.sessions.includes(session);
27
+ offerLast(ref) {
28
+ this.sessions.push(ref);
16
29
  }
17
- remove(session) {
18
- this.sessions = this.sessions.filter((s) => s !== session);
30
+ remove(ref) {
31
+ const ix = this.sessions.indexOf(ref);
32
+ if (ix > -1) {
33
+ this.sessions.splice(ix, 1);
34
+ }
19
35
  }
20
36
  [Symbol.iterator]() {
21
37
  return this.sessions[Symbol.iterator]();
22
38
  }
23
- destroy(connection) {
24
- for (const session of this.sessions) {
25
- if (session === connection) {
26
- if (!session.destroyed) {
27
- session.destroy();
28
- }
29
- }
30
- }
39
+ setMaxConcurrency(maxConcurrency) {
40
+ this.maxConcurrency = maxConcurrency;
41
+ }
42
+ destroy(ref) {
43
+ this.remove(ref);
44
+ ref.destroy();
31
45
  }
32
46
  }