p2p: trying to fix deadlock on discovery tests

This commit is contained in:
Anton Evangelatov 2018-02-14 14:14:25 +01:00
parent 0e55745d53
commit 411b9a9cdf

View file

@ -108,10 +108,11 @@ func (t *rlpx) close(err error) {
// Tell the remote end why we're disconnecting if possible. // Tell the remote end why we're disconnecting if possible.
if t.rw != nil { if t.rw != nil {
if r, ok := err.(DiscReason); ok && r != DiscNetworkError { if r, ok := err.(DiscReason); ok && r != DiscNetworkError {
t.fd.SetWriteDeadline(time.Now().Add(discWriteTimeout)) if err2 := t.fd.SetWriteDeadline(time.Now().Add(discWriteTimeout)); err2 != nil {
SendItems(t.rw, discMsg, r) SendItems(t.rw, discMsg, r)
} }
} }
}
t.fd.Close() t.fd.Close()
} }