From: Matt Joiner Date: Mon, 18 Sep 2017 02:16:59 +0000 (+1000) Subject: Log errors closing connection net.Conn's X-Git-Tag: v1.0.0~384 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=c85aac6383360b91e852b6fa843b747798f88794;p=btrtrc.git Log errors closing connection net.Conn's --- diff --git a/connection.go b/connection.go index 752f79f4..4655b136 100644 --- a/connection.go +++ b/connection.go @@ -230,8 +230,14 @@ func (cn *connection) Close() { cn.discardPieceInclination() cn.pieceRequestOrder.Clear() if cn.conn != nil { - // TODO: This call blocks sometimes, why? - go cn.conn.Close() + go func() { + // TODO: This call blocks sometimes, why? Maybe it was the Go utp + // implementation? + err := cn.conn.Close() + if err != nil { + log.Printf("error closing connection net.Conn: %s", err) + } + }() } }