Move LICENSE, make peer close idempotent

This commit is contained in:
Chad Retz 2019-02-22 14:00:02 -06:00
parent 28da432b03
commit a1c1ff95ff
2 changed files with 5 additions and 2 deletions

View File

@ -95,8 +95,11 @@ func (g *gunPeer) receive(ctx context.Context) (ok bool, msgs []*Message, err er
func (g *gunPeer) Close() error {
g.peerLock.Lock()
defer g.peerLock.Unlock()
err := g.peer.Close()
var err error
if g.peer != nil {
err = g.peer.Close()
g.peer = nil
}
g.peerBad = false
return err
}