MCPcopy
hub / github.com/cloudflare/capnweb / releaseExport

Method releaseExport

src/rpc.ts:547–561  ·  view source on GitHub ↗
(exportId: ExportId, refcount: number)

Source from the content-addressed store, hash-verified

545 }
546
547 private releaseExport(exportId: ExportId, refcount: number) {
548 let entry = this.exports[exportId];
549 if (!entry) {
550 throw new Error(`no such export ID: ${exportId}`);
551 }
552 if (entry.refcount < refcount) {
553 throw new Error(`refcount would go negative: ${entry.refcount} < ${refcount}`);
554 }
555 entry.refcount -= refcount;
556 if (entry.refcount === 0) {
557 delete this.exports[exportId];
558 this.reverseExports.delete(entry.hook);
559 entry.hook.dispose();
560 }
561 }
562
563 onSendError(error: Error): Error | void {
564 if (this.options.onSendError) {

Callers 3

unexportMethod · 0.95
ensureResolvingExportMethod · 0.95
readLoopMethod · 0.95

Calls 1

disposeMethod · 0.65

Tested by

no test coverage detected