mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-23 13:16:42 +00:00
rpc: add a minimum timeout
Signed-off-by: jsvisa <delweng@gmail.com>
This commit is contained in:
parent
116c916753
commit
e8827c4d3b
1 changed files with 1 additions and 1 deletions
|
|
@ -973,7 +973,7 @@ func (l *flakeyListener) Accept() (net.Conn, error) {
|
||||||
|
|
||||||
c, err := l.Listener.Accept()
|
c, err := l.Listener.Accept()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
timeout := time.Duration(rand.Int63n(int64(l.maxKillTimeout)))
|
timeout := max(time.Millisecond*10, time.Duration(rand.Int63n(int64(l.maxKillTimeout))))
|
||||||
time.AfterFunc(timeout, func() {
|
time.AfterFunc(timeout, func() {
|
||||||
log.Debug(fmt.Sprintf("killing conn %v after %v", c.LocalAddr(), timeout))
|
log.Debug(fmt.Sprintf("killing conn %v after %v", c.LocalAddr(), timeout))
|
||||||
c.Close()
|
c.Close()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue