Files
boc/vims-backend/node_modules/@smithy/node-http-handler/dist-es/http2/ClientHttp2SessionRef.js
T
Bernt 6de2455917 v1.2.0: Add Global Markets footer, translated to 9 languages
- Added GLOBAL_MARKETS_TITLE to all translation files
- Updated footer with 12 markets (4 active + 8 upcoming)
- Translated market section to: zh-cn, zh-tw, ja, ko, th, vi, id, ms, hi
- Built and deployed to production
- CloudFront invalidation: I3RTMXVFDJXWLG3SYX208OP1CC
2026-07-08 19:56:03 +00:00

51 lines
1.2 KiB
JavaScript

const ids = new Uint16Array(1);
export class ClientHttp2SessionRef {
id = ids[0]++;
total = 0;
max = 0;
session;
refs = 0;
constructor(session) {
session.unref();
this.session = session;
}
retain() {
if (this.session.destroyed) {
throw new Error("@smithy/node-http-handler - cannot acquire reference to destroyed session.");
}
this.refs += 1;
this.total += 1;
this.max = Math.max(this.refs, this.max);
this.session.ref();
}
free() {
if (this.session.destroyed) {
return;
}
this.refs -= 1;
if (this.refs === 0) {
this.session.unref();
}
if (this.refs < 0) {
throw new Error("@smithy/node-http-handler - ClientHttp2Session refcount at zero, cannot decrement.");
}
}
deref() {
return this.session;
}
close() {
if (!this.session.closed) {
this.session.close();
}
}
destroy() {
this.refs = 0;
if (!this.session.destroyed) {
this.session.destroy();
}
}
useCount() {
return this.refs;
}
}