From db2fe27003841cb4c443b6d0703bdc321c18fd21 Mon Sep 17 00:00:00 2001 From: Tugberk Ugurlu Date: Thu, 9 Jul 2020 23:44:25 +0100 Subject: [PATCH] only call reportDialerConnClosed when conn close succeeds feels like `reportDialerConnClosed` shouldn't be called unless `Conn.Close()` succeeds --- dialer_wrapper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dialer_wrapper.go b/dialer_wrapper.go index cebaf96..33c2c4a 100644 --- a/dialer_wrapper.go +++ b/dialer_wrapper.go @@ -159,7 +159,7 @@ func (ct *clientConnTracker) Close() error { ct.event = nil } ct.mu.Unlock() - if ct.opts.monitoring { + if ct.opts.monitoring && err == nil { reportDialerConnClosed(ct.dialerName) } return err