(source: string, target: string)
| 328 | } |
| 329 | |
| 330 | const cut = (source: string, target: string) => |
| 331 | Effect.sync(() => { |
| 332 | const active = connections.get(linkKey(source, target)) |
| 333 | const socket = active?.values().next().value as Net.Socket | undefined |
| 334 | if (socket === undefined) { |
| 335 | throw new Error(`No active socket from ${source} to ${target}`) |
| 336 | } |
| 337 | socket.destroy(new Error(`Socket cut from ${source} to ${target}`)) |
| 338 | }) |
| 339 | |
| 340 | return { add, cut, remove } |
| 341 | } |