Skip to content

Commit 5f7e384

Browse files
author
Chris S. Kim
authored
Merge pull request #252 from bwaters/remote_state_warn
Add warning message for remote node state limit
2 parents 923f1b2 + c0dd9bd commit 5f7e384

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

net.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"hash/crc32"
99
"io"
10+
"math"
1011
"net"
1112
"sync/atomic"
1213
"time"
@@ -1089,6 +1090,12 @@ func (m *Memberlist) decryptRemoteState(bufConn io.Reader, streamLabel string) (
10891090
moreBytes := binary.BigEndian.Uint32(cipherText.Bytes()[1:5])
10901091
if moreBytes > maxPushStateBytes {
10911092
return nil, fmt.Errorf("Remote node state is larger than limit (%d)", moreBytes)
1093+
1094+
}
1095+
1096+
//Start reporting the size before you cross the limit
1097+
if moreBytes > uint32(math.Floor(.6*maxPushStateBytes)) {
1098+
m.logger.Printf("[WARN] memberlist: Remote node state size is (%d) limit is (%d)", moreBytes, maxPushStateBytes)
10921099
}
10931100

10941101
// Read in the rest of the payload

0 commit comments

Comments
 (0)