multi: add buffer.Write and pool.WriteBuffer, make GCQueue generic

This commit is contained in:
Conner Fromknecht committed 2019-02-15 19:31:24 -08:00
1 parent ca4226d429
commit 6f96d04b72
12 files changed
+414 -200

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
package buffer
import (
"github.com/lightningnetwork/lnd/lnwire"
)
// WriteSize represents the size of the maximum plaintext message than can be
// sent using brontide. The buffer does not include extra space for the MAC, as
// that is applied by the Noise protocol after encrypting the plaintext.
const WriteSize = lnwire.MaxMessagePayload
// Write is static byte array occupying to maximum-allowed plaintext-message
// size.
type Write [WriteSize]byte
// Recycle zeroes the Write, making it fresh for another use.
func (b *Write) Recycle() {
RecycleSlice(b[:])
}