track error (#1815)
* track error * remove useless code Co-authored-by: huanghuan.27@bytedance.com <huanghuan.27@bytedance.com> Co-authored-by: Asim Aslam <asim@aslam.me>
This commit is contained in:
parent
630ceb5dad
commit
8e30ede8c7
@ -84,14 +84,22 @@ func encode(txt *mdnsTxt) ([]string, error) {
|
||||
defer buf.Reset()
|
||||
|
||||
w := zlib.NewWriter(&buf)
|
||||
defer func() {
|
||||
if closeErr := w.Close(); closeErr != nil {
|
||||
if logger.V(logger.ErrorLevel, logger.DefaultLogger) {
|
||||
logger.Errorf("[mdns] registry close encoding writer err: %v", closeErr)
|
||||
}
|
||||
}
|
||||
}()
|
||||
if _, err := w.Write(b); err != nil {
|
||||
w.Close()
|
||||
return nil, err
|
||||
}
|
||||
w.Close()
|
||||
|
||||
if err = w.Close(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
encoded := hex.EncodeToString(buf.Bytes())
|
||||
|
||||
// individual txt limit
|
||||
if len(encoded) <= 255 {
|
||||
return []string{encoded}, nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user