mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +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
|
||||
}
|
||||
switch received.(type) {
|
||||
|
||||
switch res := received.(type) {
|
||||
case *T:
|
||||
res := received.(*T)
|
||||
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.
|
||||
// It returns whether the peer disconnects in the next 100ms.
|
||||
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)
|
||||
return err == errDisc
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue