mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 23:26:44 +00:00
fix lint
This commit is contained in:
parent
beb451ee7f
commit
177b34114f
1 changed files with 4 additions and 3 deletions
|
|
@ -877,9 +877,9 @@ func readUntil[T any](ctx context.Context, conn *Conn) (*T, error) {
|
||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
switch received.(type) {
|
|
||||||
|
switch res := received.(type) {
|
||||||
case *T:
|
case *T:
|
||||||
res := received.(*T)
|
|
||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -888,7 +888,8 @@ func readUntil[T any](ctx context.Context, conn *Conn) (*T, error) {
|
||||||
// readUntilDisconnect reads eth protocol messages until the peer disconnects.
|
// readUntilDisconnect reads eth protocol messages until the peer disconnects.
|
||||||
// It returns whether the peer disconnects in the next 100ms.
|
// It returns whether the peer disconnects in the next 100ms.
|
||||||
func readUntilDisconnect(conn *Conn) (disconnected bool) {
|
func readUntilDisconnect(conn *Conn) (disconnected bool) {
|
||||||
ctx, _ := context.WithTimeout(context.Background(), 100*time.Millisecond)
|
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
|
||||||
|
defer cancel()
|
||||||
_, err := readUntil[struct{}](ctx, conn)
|
_, err := readUntil[struct{}](ctx, conn)
|
||||||
return err == errDisc
|
return err == errDisc
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue