Skip to content

Commit

Permalink
Merge pull request #9 from toolkits/fix-net
Browse files Browse the repository at this point in the history
fix rpc client panic
  • Loading branch information
UlricQin authored Oct 20, 2022
2 parents 9f9f830 + 9807887 commit 2a2a483
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions net/gobrpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func (c *RPCClient) Call(method string, args interface{}, reply interface{}, cal
done := make(chan error, 1)

go func() {
if c.rpcClient == nil {
done <- fmt.Errorf("rpc client is nil")
return
}
err := c.rpcClient.Call(method, args, reply)
done <- err
}()
Expand All @@ -59,6 +63,4 @@ func (c *RPCClient) Call(method string, args interface{}, reply interface{}, cal
case err := <-done:
return err
}

return nil
}

0 comments on commit 2a2a483

Please # to comment.