Skip to content

Commit

Permalink
Merge pull request #16 from capnspacehook/out-buffer
Browse files Browse the repository at this point in the history
Fix rapid sending/receiving of messages
  • Loading branch information
awgh authored Nov 21, 2019
2 parents 3f36dfa + ce66428 commit 99e48c7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion nodes/db/dbnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import (
"upper.io/db.v3/lib/sqlbuilder"
)

var OutBufferSize = 128

// Node : defines an instance of the API with a ql-DB backed Node
type Node struct {
contentKey bc.KeyPair
Expand Down Expand Up @@ -52,7 +54,7 @@ func New(contentKey, routingKey bc.KeyPair) *Node {

// setup chans
node.in = make(chan api.Msg)
node.out = make(chan api.Msg)
node.out = make(chan api.Msg, OutBufferSize)
node.events = make(chan api.Event)

// setup default router
Expand Down
4 changes: 3 additions & 1 deletion nodes/fs/fsnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import (
"github.com/awgh/ratnet/router"
)

var OutBufferSize = 128

type outboxMsg struct {
channel string
msg []byte
Expand Down Expand Up @@ -68,7 +70,7 @@ func New(contentKey, routingKey bc.KeyPair, basePath string) *Node {

// setup chans
node.in = make(chan api.Msg)
node.out = make(chan api.Msg)
node.out = make(chan api.Msg, OutBufferSize)
node.events = make(chan api.Event)

// setup default router
Expand Down
4 changes: 3 additions & 1 deletion nodes/qldb/qlnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import (
_ "modernc.org/ql/driver" // load the QL database driver
)

var OutBufferSize = 128

// Node : defines an instance of the API with a ql-DB backed Node
type Node struct {
contentKey bc.KeyPair
Expand Down Expand Up @@ -52,7 +54,7 @@ func New(contentKey, routingKey bc.KeyPair) *Node {

// setup chans
node.in = make(chan api.Msg)
node.out = make(chan api.Msg)
node.out = make(chan api.Msg, OutBufferSize)
node.events = make(chan api.Event)

// setup default router
Expand Down
4 changes: 3 additions & 1 deletion nodes/ram/ramnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"github.com/awgh/ratnet/router"
)

var OutBufferSize = 128

// Node : defines an instance of the API with a ql-DB backed Node
type Node struct {
contentKey bc.KeyPair
Expand Down Expand Up @@ -69,7 +71,7 @@ func New(contentKey, routingKey bc.KeyPair) *Node {

// setup chans
node.in = make(chan api.Msg)
node.out = make(chan api.Msg)
node.out = make(chan api.Msg, OutBufferSize)
node.events = make(chan api.Event)

// setup default router
Expand Down

0 comments on commit 99e48c7

Please sign in to comment.