Recv next message after send returns EOF (#7872)

This commit is contained in:
Daniel Nelson 2020-07-21 15:24:45 -07:00 committed by GitHub
parent 5efce718e1
commit b9a71880d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -217,7 +217,11 @@ func (c *GNMI) subscribeGNMI(ctx context.Context, address string, tlscfg *tls.Co
}
if err = subscribeClient.Send(request); err != nil {
return fmt.Errorf("failed to send subscription request: %v", err)
// If io.EOF is returned, the stream may have ended and stream status
// can be determined by calling Recv.
if err != io.EOF {
return fmt.Errorf("failed to send subscription request: %v", err)
}
}
c.Log.Debugf("Connection to gNMI device %s established", address)