diff options
| author | amankumarsingh77 <amankumarsingh7702@gmail.com> | 2026-07-28 21:47:21 +0530 |
|---|---|---|
| committer | Aman Kumar <145339995+amankumarsingh77@users.noreply.github.com> | 2026-08-02 19:12:46 +0530 |
| commit | aedbb88a8025851067be9f77ec406b29d65599a8 (patch) | |
| tree | 8e62b333e4aad20998056614e19acd34ff6abc3b /src/daemon/server.ts | |
| parent | ea11182a0e8cb62d208b5b53a60c98c8bdef9e9a (diff) | |
refactor: delete exports and knobs that nothing calls
isInternalUrl, SPECIAL_KEYS, andThen and mapErr had no callers in src or
test. BrowserState.remoteBrowserId was parsed on restore and never
written — the field that is actually read lives on DaemonStatus.
IpcServer.disconnectClient and IpcServer.clients() were unreachable, as
was EventRouter.allClients and a write-only lineCount counter.
DAEMON_STALE_SOCKET_CLEANUP was a hardcoded true with an if around it, so
the unlink now runs unconditionally.
CdpBridge.isAlive and getSessionOwner look equally dead from src/ alone,
but test/manual/bridge-test.ts drives both — they are the only seams that
suite has, so they stay.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'src/daemon/server.ts')
| -rw-r--r-- | src/daemon/server.ts | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/daemon/server.ts b/src/daemon/server.ts index 7c78372..142bddb 100644 --- a/src/daemon/server.ts +++ b/src/daemon/server.ts @@ -7,7 +7,6 @@ import { isWireMessage, DAEMON_SOCKET_PATH, DAEMON_MAX_CLIENTS, - DAEMON_STALE_SOCKET_CLEANUP, } from "./protocol"; export type ClientSocket = { @@ -29,8 +28,6 @@ export type IpcServer = { onDisconnect(handler: ConnectionHandler): void; send(clientId: string, msg: WireMessage): void; broadcast(msg: WireMessage): void; - disconnectClient(clientId: string): void; - clients(): ReadonlyMap<string, ClientSocket>; clientCount(): number; }; @@ -45,11 +42,9 @@ export const createIpcServer = (): IpcServer => { const start = (): Promise<void> => new Promise((resolve, reject) => { - if (DAEMON_STALE_SOCKET_CLEANUP) { - try { - unlinkSync(DAEMON_SOCKET_PATH); - } catch {} - } + try { + unlinkSync(DAEMON_SOCKET_PATH); + } catch {} server = createServer({ pauseOnConnect: false }, (socket: Socket) => { if (clients.size >= DAEMON_MAX_CLIENTS) { @@ -63,10 +58,7 @@ export const createIpcServer = (): IpcServer => { sockets.set(tempId, currentClient); - let lineCount = 0; - rl.on("line", (line: string) => { - lineCount++; let msg: WireMessage | null; try { const parsed: unknown = JSON.parse(line); @@ -178,12 +170,6 @@ export const createIpcServer = (): IpcServer => { this.send(clientId, msg); } }, - disconnectClient(clientId) { - const client = clients.get(clientId); - if (!client) return; - client.socket.destroy(); - }, - clients: (): ReadonlyMap<string, ClientSocket> => clients, clientCount: (): number => clients.size, }; }; |
