Skip to content

Commit

Permalink
tcp: update after protocol breaking change
Browse files Browse the repository at this point in the history
jtroo/kanata@9d3d87b introduced a proper `Error` response, but this breaks current kanata-tray code. After this change previous, as well as new kanata versions should work.
  • Loading branch information
rszyma committed Feb 23, 2024
1 parent 5cc7578 commit fd9a93a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion runner/tcp_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func (c *KanataTcpClient) Connect(ctx context.Context, port int) error {
scanner := bufio.NewScanner(c.conn)
for scanner.Scan() {
var msgBytes = scanner.Bytes()
if bytes.HasPrefix(msgBytes, []byte("you sent an invalid message")) {
// do not change the following condition (because of cross-version compability)
if bytes.Contains(msgBytes, []byte("you sent an invalid message")) {
fmt.Printf("Kanata disconnected us because we supposedly sent an 'invalid message' (kanata version is too old?)\n")
c.reconnect <- struct{}{}
return
Expand Down

0 comments on commit fd9a93a

Please sign in to comment.