Remove simple sleep from router accept
This commit is contained in:
1 parent
835d99e6fe
commit
b67c102fe5
1 file changed
+1
-7
+1
-7
@@ -16,17 +16,12 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
macMaxAge = 10 * time.Minute // [1]
|
macMaxAge = 10 * time.Minute // [1]
|
||||||
tcpAcceptDelay = 1 * time.Millisecond // [2]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// [1] should be greater than typical ARP cache expiries, i.e. > 3/2 *
|
// [1] should be greater than typical ARP cache expiries, i.e. > 3/2 *
|
||||||
// /proc/sys/net/ipv4_neigh/*/base_reachable_time_ms on Linux
|
// /proc/sys/net/ipv4_neigh/*/base_reachable_time_ms on Linux
|
||||||
|
|
||||||
// [2] time to wait between accepting tcp connections. This guards
|
|
||||||
// against brute-force attacks on the password when encryption is in
|
|
||||||
// use. It is also a basic DoS defence.
|
|
||||||
|
|
||||||
type LogFrameFunc func(string, []byte, *layers.Ethernet)
|
type LogFrameFunc func(string, []byte, *layers.Ethernet)
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
@@ -212,7 +207,6 @@ func (router *Router) listenTCP(localPort int) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
router.acceptTCP(tcpConn)
|
router.acceptTCP(tcpConn)
|
||||||
time.Sleep(tcpAcceptDelay)
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user