MCPcopy
hub / github.com/OpenNHP/opennhp / exitResource

Method exitResource

endpoints/js-agent/src/NHPAgent.ts:316–331  ·  view source on GitHub ↗

* Exit/release access to a resource

(resource: ResourceConfig)

Source from the content-addressed store, hash-verified

314 * Exit/release access to a resource
315 */
316 async exitResource(resource: ResourceConfig): Promise<void> {
317 const serverId = `${resource.serverHost}:${resource.serverPort}`;
318 const server = this.servers.get(serverId);
319
320 if (server) {
321 clearServerCookie(server.publicKey, this.packetContext);
322 }
323
324 const transport = this.transports.get(serverId);
325 if (transport) {
326 transport.disconnect();
327 this.transports.delete(serverId);
328 }
329
330 this.log('debug', `Exited resource: ${resource.resourceId}`);
331 }
332
333 /**
334 * Register an event handler

Callers 1

NHPAgent.test.tsFile · 0.80

Calls 3

logMethod · 0.95
clearServerCookieFunction · 0.90
disconnectMethod · 0.65

Tested by

no test coverage detected