From 87ba7248644baeed3d69c9a27e762babc8fb7a1d Mon Sep 17 00:00:00 2001 From: patrickhuie19 Date: Fri, 12 Jul 2024 12:30:22 -0400 Subject: [PATCH] adding nil transport check in the case the state is not ready --- client.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client.go b/client.go index 16c9fa4..5a7d573 100644 --- a/client.go +++ b/client.go @@ -417,6 +417,11 @@ func (cc *ClientConn) Invoke(ctx context.Context, method string, args interface{ } cc.addrConn.mu.RLock() tr = cc.addrConn.transport + if tr == nil { + defer cc.mu.RUnlock() + // State is reconnecting + return errors.New("connection is not ready") + } cc.addrConn.mu.RUnlock() cc.mu.RUnlock()