lnwire+peer: clamp pong bytes, make ping handler more effcieint
This was not properly enforced and would be a spec violation on the peer's end. Also re-use a pong buffer to save on heap allocations if there are a lot of peers. The pong buffer is only read from, so this is concurrent safe.
This commit is contained in:
6 files changed
+55
-7
No files matched your search
@@ -999,6 +999,7 @@ func TestStaticRemoteDowngrade(t *testing.T) {
|
||||
Features: test.features,
|
||||
Conn: mockConn,
|
||||
WritePool: writePool,
|
||||
PongBuf: make([]byte, lnwire.MaxPongBytes),
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1103,6 +1104,7 @@ func TestPeerCustomMessage(t *testing.T) {
|
||||
}
|
||||
return nil
|
||||
},
|
||||
PongBuf: make([]byte, lnwire.MaxPongBytes),
|
||||
})
|
||||
|
||||
// Set up the init sequence.
|
||||
|
||||
Reference in new issue
Block a user