Only run connection.Close once
Avoids unnecessary error messages for net.Conn.Close
This commit is contained in:
parent
19adb2cac3
commit
0790516440
|
@ -226,7 +226,9 @@ func priorityBitmapHeadAsSlice(pb *prioritybitmap.PriorityBitmap, n int) (ret []
|
|||
}
|
||||
|
||||
func (cn *connection) Close() {
|
||||
cn.closed.Set()
|
||||
if !cn.closed.Set() {
|
||||
return
|
||||
}
|
||||
cn.discardPieceInclination()
|
||||
cn.pieceRequestOrder.Clear()
|
||||
if cn.conn != nil {
|
||||
|
|
Loading…
Reference in New Issue