This commit is contained in:
Chris Tate
2026-01-11 23:55:29 -06:00
parent 343aa1f723
commit d84a769949
6 changed files with 56 additions and 39 deletions
+4 -2
View File
@@ -33,7 +33,7 @@ export function getSession(): string {
function getPortForSession(session: string): number {
let hash = 0;
for (let i = 0; i < session.length; i++) {
hash = ((hash << 5) - hash) + session.charCodeAt(i);
hash = (hash << 5) - hash + session.charCodeAt(i);
hash |= 0;
}
// Port range 49152-65535 (dynamic/private ports)
@@ -90,7 +90,9 @@ export function isDaemonRunning(session?: string): boolean {
* Get connection info for the current session
* Returns { type: 'unix', path: string } or { type: 'tcp', port: number }
*/
export function getConnectionInfo(session?: string): { type: 'unix'; path: string } | { type: 'tcp'; port: number } {
export function getConnectionInfo(
session?: string
): { type: 'unix'; path: string } | { type: 'tcp'; port: number } {
const sess = session ?? currentSession;
if (isWindows) {
return { type: 'tcp', port: getPortForSession(sess) };