go fmt ./...

This commit is contained in:
Matt Joiner 2021-09-09 22:51:24 +10:00
parent 5cb47021ac
commit 35064425eb
2 changed files with 3 additions and 5 deletions

View File

@ -102,7 +102,6 @@ func (cl *Client) badPeerIPsLocked() (ips []string) {
return return
} }
func (cl *Client) PeerID() PeerID { func (cl *Client) PeerID() PeerID {
return cl.peerID return cl.peerID
} }
@ -420,8 +419,8 @@ func (cl *Client) eachDhtServer(f func(DhtServer)) {
// Stops the client. All connections to peers are closed and all activity will // Stops the client. All connections to peers are closed and all activity will
// come to a halt. // come to a halt.
func (cl *Client) Close() { func (cl *Client) Close() {
var closeGroup sync.WaitGroup //WaitGroup for any concurrent cleanup to complete before returning. var closeGroup sync.WaitGroup // WaitGroup for any concurrent cleanup to complete before returning.
defer closeGroup.Wait() //defer is LIFO. We want to Wait() after cl.unlock() defer closeGroup.Wait() // defer is LIFO. We want to Wait() after cl.unlock()
cl.lock() cl.lock()
defer cl.unlock() defer cl.unlock()
cl.closed.Set() cl.closed.Set()
@ -1259,7 +1258,6 @@ func useTorrentSource(ctx context.Context, source string, t *Torrent) (err error
return t.MergeSpec(TorrentSpecFromMetaInfo(&mi)) return t.MergeSpec(TorrentSpecFromMetaInfo(&mi))
} }
func (cl *Client) dropTorrent(infoHash metainfo.Hash) (err error) { func (cl *Client) dropTorrent(infoHash metainfo.Hash) (err error) {
t, ok := cl.torrents[infoHash] t, ok := cl.torrents[infoHash]
if !ok { if !ok {

View File

@ -126,7 +126,7 @@ func Handshake(
copyExact := func(dst []byte, src []byte) { copyExact := func(dst []byte, src []byte) {
if dstLen, srcLen := uint64(len(dst)), uint64(len(src)); dstLen != srcLen { if dstLen, srcLen := uint64(len(dst)), uint64(len(src)); dstLen != srcLen {
panic("dst len " + strconv.FormatUint(dstLen,10) + " != src len " + strconv.FormatUint(srcLen,10)) panic("dst len " + strconv.FormatUint(dstLen, 10) + " != src len " + strconv.FormatUint(srcLen, 10))
} }
copy(dst, src) copy(dst, src)
} }