Make MaxGossipPacketSize public (#2475)

Downstream implementations might want to configure it.

Signed-off-by: gotjosh <josue@grafana.com>
This commit is contained in:
gotjosh 2021-02-05 17:06:47 +00:00 committed by GitHub
parent f2f7a72813
commit e6a1bede89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -145,5 +145,5 @@ func (c *Channel) Broadcast(b []byte) {
// OversizedMessage indicates whether or not the byte payload should be sent // OversizedMessage indicates whether or not the byte payload should be sent
// via TCP. // via TCP.
func OversizedMessage(b []byte) bool { func OversizedMessage(b []byte) bool {
return len(b) > maxGossipPacketSize/2 return len(b) > MaxGossipPacketSize/2
} }

View File

@ -103,7 +103,7 @@ const (
DefaultReconnectInterval = 10 * time.Second DefaultReconnectInterval = 10 * time.Second
DefaultReconnectTimeout = 6 * time.Hour DefaultReconnectTimeout = 6 * time.Hour
DefaultRefreshInterval = 15 * time.Second DefaultRefreshInterval = 15 * time.Second
maxGossipPacketSize = 1400 MaxGossipPacketSize = 1400
) )
func Create( func Create(
@ -202,7 +202,7 @@ func Create(
cfg.ProbeInterval = probeInterval cfg.ProbeInterval = probeInterval
cfg.LogOutput = &logWriter{l: l} cfg.LogOutput = &logWriter{l: l}
cfg.GossipNodes = retransmit cfg.GossipNodes = retransmit
cfg.UDPBufferSize = maxGossipPacketSize cfg.UDPBufferSize = MaxGossipPacketSize
if advertiseHost != "" { if advertiseHost != "" {
cfg.AdvertiseAddr = advertiseHost cfg.AdvertiseAddr = advertiseHost