From 727f2f2404ba4bba34443f7900cd4ffada224725 Mon Sep 17 00:00:00 2001 From: Ned Palacios Date: Thu, 1 Feb 2024 13:22:17 +0800 Subject: [PATCH] fix: adjust connection states, isconnected() --- server/daemon/client/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/daemon/client/client.go b/server/daemon/client/client.go index c8a2344..48c2ab9 100644 --- a/server/daemon/client/client.go +++ b/server/daemon/client/client.go @@ -18,9 +18,9 @@ type ConnectionState int const ( NotConnectedState ConnectionState = 0 + ShutdownState ConnectionState = iota ConnectedState ConnectionState = iota InitializedState ConnectionState = iota - ShutdownState ConnectionState = iota ) const defaultConnectDelay = 750 * time.Millisecond @@ -58,7 +58,7 @@ func (c *Client) processIdField() jsonrpc2.CallOption { } func (c *Client) IsConnected() bool { - return c.rpcConn != nil && c.connState == ConnectedState + return c.rpcConn != nil && c.connState >= ConnectedState } func (c *Client) tryReconnect(reason error) error {