mirror of
https://github.com/ChronosX88/go-gun.git
synced 2024-11-23 10:52:19 +00:00
Move LICENSE, make peer close idempotent
This commit is contained in:
parent
28da432b03
commit
a1c1ff95ff
@ -95,8 +95,11 @@ func (g *gunPeer) receive(ctx context.Context) (ok bool, msgs []*Message, err er
|
|||||||
func (g *gunPeer) Close() error {
|
func (g *gunPeer) Close() error {
|
||||||
g.peerLock.Lock()
|
g.peerLock.Lock()
|
||||||
defer g.peerLock.Unlock()
|
defer g.peerLock.Unlock()
|
||||||
err := g.peer.Close()
|
var err error
|
||||||
g.peer = nil
|
if g.peer != nil {
|
||||||
|
err = g.peer.Close()
|
||||||
|
g.peer = nil
|
||||||
|
}
|
||||||
g.peerBad = false
|
g.peerBad = false
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user