ABCIAppClient conn close (#2236)

Refs https://github.com/grpc/grpc-go/issues/2264
This commit is contained in:
bradyjoestar 2018-08-17 15:59:46 +08:00 committed by Anton Kaliaev
parent d69cf9dd2f
commit 62b2093da5
1 changed files with 6 additions and 6 deletions

View File

@ -22,6 +22,7 @@ type grpcClient struct {
mustConnect bool
client types.ABCIApplicationClient
conn *grpc.ClientConn
mtx sync.Mutex
addr string
@ -60,6 +61,7 @@ RETRY_LOOP:
cli.Logger.Info("Dialed server. Waiting for echo.", "addr", cli.addr)
client := types.NewABCIApplicationClient(conn)
cli.conn = conn
ENSURE_CONNECTED:
for {
@ -78,12 +80,10 @@ RETRY_LOOP:
func (cli *grpcClient) OnStop() {
cli.BaseService.OnStop()
cli.mtx.Lock()
defer cli.mtx.Unlock()
// TODO: how to close conn? its not a net.Conn and grpc doesn't expose a Close()
/*if cli.client.conn != nil {
cli.client.conn.Close()
}*/
if cli.conn != nil {
cli.conn.Close()
}
}
func (cli *grpcClient) StopForError(err error) {