Browse Source

ABCIAppClient conn close (#2236)

Refs https://github.com/grpc/grpc-go/issues/2264
pull/2243/merge
bradyjoestar 6 years ago
committed by Anton Kaliaev
parent
commit
62b2093da5
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      abci/client/grpc_client.go

+ 6
- 6
abci/client/grpc_client.go View File

@ -22,6 +22,7 @@ type grpcClient struct {
mustConnect bool mustConnect bool
client types.ABCIApplicationClient client types.ABCIApplicationClient
conn *grpc.ClientConn
mtx sync.Mutex mtx sync.Mutex
addr string addr string
@ -60,6 +61,7 @@ RETRY_LOOP:
cli.Logger.Info("Dialed server. Waiting for echo.", "addr", cli.addr) cli.Logger.Info("Dialed server. Waiting for echo.", "addr", cli.addr)
client := types.NewABCIApplicationClient(conn) client := types.NewABCIApplicationClient(conn)
cli.conn = conn
ENSURE_CONNECTED: ENSURE_CONNECTED:
for { for {
@ -78,12 +80,10 @@ RETRY_LOOP:
func (cli *grpcClient) OnStop() { func (cli *grpcClient) OnStop() {
cli.BaseService.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) { func (cli *grpcClient) StopForError(err error) {


Loading…
Cancel
Save