mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 09:53:48 +00:00
p2p: remove nil check in rlpxTransport.close
This commit is contained in:
parent
d109446f86
commit
a87cb59168
1 changed files with 9 additions and 11 deletions
|
|
@ -113,19 +113,17 @@ func (t *rlpxTransport) close(err error) {
|
||||||
// Tell the remote end why we're disconnecting if possible.
|
// Tell the remote end why we're disconnecting if possible.
|
||||||
// We only bother doing this if the underlying connection supports
|
// We only bother doing this if the underlying connection supports
|
||||||
// setting a timeout tough.
|
// setting a timeout tough.
|
||||||
if t.conn != nil {
|
if reason, ok := err.(DiscReason); ok && reason != DiscNetworkError {
|
||||||
if reason, ok := err.(DiscReason); ok && reason != DiscNetworkError {
|
// We do not use the WriteMsg func since we want a custom deadline
|
||||||
// We do not use the WriteMsg func since we want a custom deadline
|
deadline := time.Now().Add(discWriteTimeout)
|
||||||
deadline := time.Now().Add(discWriteTimeout)
|
if err := t.conn.SetWriteDeadline(deadline); err == nil {
|
||||||
if err := t.conn.SetWriteDeadline(deadline); err == nil {
|
// Connection supports write deadline.
|
||||||
// Connection supports write deadline.
|
t.wbuf.Reset()
|
||||||
t.wbuf.Reset()
|
rlp.Encode(&t.wbuf, []any{reason})
|
||||||
rlp.Encode(&t.wbuf, []any{reason})
|
t.conn.Write(discMsg, t.wbuf.Bytes())
|
||||||
t.conn.Write(discMsg, t.wbuf.Bytes())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
t.conn.Close()
|
|
||||||
}
|
}
|
||||||
|
t.conn.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *rlpxTransport) doEncHandshake(prv *ecdsa.PrivateKey) (*ecdsa.PublicKey, error) {
|
func (t *rlpxTransport) doEncHandshake(prv *ecdsa.PrivateKey) (*ecdsa.PublicKey, error) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue