mirror of
https://github.com/jahruz67/wisp-open.git
synced 2026-08-08 18:14:08 +00:00
fix: enhance second instance command handling and maintain backward compatibility
This commit is contained in:
@@ -91,23 +91,22 @@ func runSecondInstanceListener() {
|
||||
defer conn.Close()
|
||||
buf := make([]byte, 1)
|
||||
n, _ := conn.Read(buf)
|
||||
cmd := instanceCmdShow
|
||||
if n == 1 {
|
||||
select {
|
||||
case secondInstanceCommand <- buf[0]:
|
||||
default:
|
||||
cmd = buf[0]
|
||||
}
|
||||
} else {
|
||||
// Backwards-compatible: any connection with no payload = show window.
|
||||
select {
|
||||
case secondInstanceCommand <- instanceCmdShow:
|
||||
case secondInstanceCommand <- cmd:
|
||||
default:
|
||||
}
|
||||
}
|
||||
_, _ = io.Copy(io.Discard, conn)
|
||||
if cmd == instanceCmdShow {
|
||||
select {
|
||||
case secondInstanceWake <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
}
|
||||
}(c)
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user