p2p: remove nil check in rlpxTransport.close

This commit is contained in:
Felix Lange 2024-12-10 15:44:05 +01:00
parent d109446f86
commit a87cb59168

View file

@ -113,7 +113,6 @@ 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)
@ -126,7 +125,6 @@ func (t *rlpxTransport) close(err error) {
} }
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) {
t.conn.SetDeadline(time.Now().Add(handshakeTimeout)) t.conn.SetDeadline(time.Now().Add(handshakeTimeout))