Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
noot committed May 21, 2021
1 parent e666056 commit a4199e9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dot/network/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ func NewService(cfg *Config) (*Service, error) {
}

// pre-allocate pool of buffers used to read from streams.
// initially allocate as many buffers as minimally necessary which is the number inbound streams we will have,
// which should equal min peers times the number of notifications protocols, which is currently 3.
// initially allocate as many buffers as liekly necessary which is the number inbound streams we will have,
// which should equal average number of peers times the number of notifications protocols, which is currently 3.
var bufPool *sizedBufferPool
if cfg.noPreAllocate {
bufPool = &sizedBufferPool{
c: make(chan *[maxMessageSize]byte, cfg.MaxPeers*4),
c: make(chan *[maxMessageSize]byte, cfg.MaxPeers*3),
}
} else {
bufPool = newSizedBufferPool(cfg.MinPeers*4, cfg.MaxPeers*4)
bufPool = newSizedBufferPool((cfg.MaxPeers-cfg.MinPeers)*3/2, (cfg.MaxPeers+1)*3)
}

network := &Service{
Expand Down

0 comments on commit a4199e9

Please sign in to comment.