peer: reduce upper bound of pong bytes to ease bandwidth load
This commit is contained in:
1 parent
2845c6497a
commit
94a9baefeb
1 file changed
+12
-7
+12
-7
@@ -76,6 +76,12 @@ const (
|
|||||||
|
|
||||||
// ErrorBufferSize is the number of historic peer errors that we store.
|
// ErrorBufferSize is the number of historic peer errors that we store.
|
||||||
ErrorBufferSize = 10
|
ErrorBufferSize = 10
|
||||||
|
|
||||||
|
// pongSizeCeiling is the upper bound on a uniformly distributed random
|
||||||
|
// variable that we use for requesting pong responses. We don't use the
|
||||||
|
// MaxPongBytes (upper bound accepted by the protocol) because it is
|
||||||
|
// needlessly wasteful of precious Tor bandwidth for little to no gain.
|
||||||
|
pongSizeCeiling = 4096
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -558,17 +564,16 @@ func NewBrontide(cfg Config) *Brontide {
|
|||||||
return lastSerializedBlockHeader[:]
|
return lastSerializedBlockHeader[:]
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(roasbeef): make dynamic in order to
|
// TODO(roasbeef): make dynamic in order to create fake cover traffic.
|
||||||
// create fake cover traffic
|
//
|
||||||
// NOTE(proofofkeags): this was changed to be
|
// NOTE(proofofkeags): this was changed to be dynamic to allow better
|
||||||
// dynamic to allow better pong identification,
|
// pong identification, however, more thought is needed to make this
|
||||||
// however, more thought is needed to make this
|
// actually usable as a traffic decoy.
|
||||||
// actually usable as a traffic decoy
|
|
||||||
randPongSize := func() uint16 {
|
randPongSize := func() uint16 {
|
||||||
return uint16(
|
return uint16(
|
||||||
// We don't need cryptographic randomness here.
|
// We don't need cryptographic randomness here.
|
||||||
/* #nosec */
|
/* #nosec */
|
||||||
rand.Intn(lnwire.MaxPongBytes + 1),
|
rand.Intn(pongSizeCeiling) + 1,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user