diff --git a/core/client.go b/core/client.go index 26656b730..930e30c1a 100644 --- a/core/client.go +++ b/core/client.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "io" "reflect" "runtime" "time" @@ -266,6 +267,12 @@ func (c *Client) handleFrameError(err error, reconnection chan<- struct{}) { c.errorfn(err) + // exit client program if stream has be closed. + if err == io.EOF { + c.ctxCancel() + return + } + // always attempting to reconnect if an error is encountered, // the error is mostly network error. select { diff --git a/core/metadata_test.go b/core/metadata_test.go index 902a89be4..d768fcc9c 100644 --- a/core/metadata_test.go +++ b/core/metadata_test.go @@ -31,7 +31,6 @@ func TestMetadata(t *testing.T) { func TestMetadataSlogAttr(t *testing.T) { md := metadata.New(map[string]string{ "aaaa": "bbbb", - "cccc": "dddd", }) buf := bytes.NewBuffer(nil) @@ -50,5 +49,5 @@ func TestMetadataSlogAttr(t *testing.T) { logger.Debug("test metadata", MetadataSlogAttr(md)) - assert.Equal(t, "level=DEBUG msg=\"test metadata\" metadata.aaaa=bbbb metadata.cccc=dddd\n", buf.String()) + assert.Equal(t, "level=DEBUG msg=\"test metadata\" metadata.aaaa=bbbb\n", buf.String()) }