mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-03 21:08:17 +08:00
shrink msgio buffer size to decrease memory pressure
This commit is contained in:
@ -184,13 +184,15 @@ func (s *SecurePipe) handshake() error {
|
||||
}
|
||||
|
||||
cmp := bytes.Compare(myPubKey, proposeResp.GetPubkey())
|
||||
mIV, tIV, mCKey, tCKey, mMKey, tMKey := ci.KeyStretcher(cmp, cipherType, hashType, secret)
|
||||
//ci.KeyStretcher(cmp, cipherType, hashType, secret)
|
||||
|
||||
go s.handleSecureIn(hashType, cipherType, tIV, tCKey, tMKey)
|
||||
go s.handleSecureOut(hashType, cipherType, mIV, mCKey, mMKey)
|
||||
if true {
|
||||
mIV, tIV, mCKey, tCKey, mMKey, tMKey := ci.KeyStretcher(cmp, cipherType, hashType, secret)
|
||||
|
||||
/*
|
||||
go s.handleSecureIn(hashType, cipherType, tIV, tCKey, tMKey)
|
||||
go s.handleSecureOut(hashType, cipherType, mIV, mCKey, mMKey)
|
||||
|
||||
} else {
|
||||
log.Critical("Secure Channel Disabled! PLEASE ENSURE YOU KNOW WHAT YOU ARE DOING")
|
||||
// Disable Secure Channel
|
||||
go func(sp *SecurePipe) {
|
||||
for {
|
||||
@ -220,7 +222,7 @@ func (s *SecurePipe) handshake() error {
|
||||
}
|
||||
}
|
||||
}(s)
|
||||
*/
|
||||
}
|
||||
|
||||
finished := []byte("Finished")
|
||||
|
||||
|
@ -7,8 +7,8 @@ import (
|
||||
|
||||
ci "github.com/jbenet/go-ipfs/crypto"
|
||||
"github.com/jbenet/go-ipfs/peer"
|
||||
"github.com/jbenet/go-ipfs/pipes"
|
||||
"github.com/jbenet/go-ipfs/util"
|
||||
"github.com/jbenet/go-ipfs/util/pipes"
|
||||
)
|
||||
|
||||
func getPeer(tb testing.TB) peer.Peer {
|
||||
|
@ -22,7 +22,7 @@ const (
|
||||
ChanBuffer = 10
|
||||
|
||||
// MaxMessageSize is the size of the largest single message
|
||||
MaxMessageSize = 1 << 22 // 4 MB
|
||||
MaxMessageSize = 1 << 21 // 4 MB
|
||||
|
||||
// HandshakeTimeout for when nodes first connect
|
||||
HandshakeTimeout = time.Second * 5
|
||||
@ -39,7 +39,11 @@ func init() {
|
||||
}
|
||||
|
||||
func ReleaseBuffer(b []byte) {
|
||||
log.Warningf("Releasing buffer! (size = %d)", cap(b))
|
||||
log.Warningf("Releasing buffer! (cap,size = %d, %d)", cap(b), len(b))
|
||||
if cap(b) != MaxMessageSize {
|
||||
log.Warning("Release buffer failed.")
|
||||
return
|
||||
}
|
||||
BufferPool.Put(b[:cap(b)])
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user