aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei-Ning Huang <w@byzantine-lab.io>2019-08-28 20:54:07 +0800
committerWei-Ning Huang <w@byzantine-lab.io>2019-09-17 16:57:31 +0800
commit4db99d21b706bb767f0d4aae505da3893276d843 (patch)
tree68878fcb6f9eeb3b0f8706672b14856afcfebf45
parent2ae7b0db497d8f7793c51a0420f1f2d676f228fd (diff)
downloadgo-tangerine-4db99d21b706bb767f0d4aae505da3893276d843.tar.gz
go-tangerine-4db99d21b706bb767f0d4aae505da3893276d843.tar.zst
go-tangerine-4db99d21b706bb767f0d4aae505da3893276d843.zip
dex: remove non-blocking message send
Let's keep as many as data first, and figure out a better way to deal with data flooding later.
-rw-r--r--dex/handler.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/dex/handler.go b/dex/handler.go
index 19ca52573..8031f3639 100644
--- a/dex/handler.go
+++ b/dex/handler.go
@@ -92,6 +92,8 @@ const (
maxAgreementResultBroadcast = 3
maxFinalizedBlockBroadcast = 3
checkPeerDuration = 10 * time.Minute
+
+ receiveChannelSize = 2048
)
// errIncompatibleConfig is returned if the requested protocols and configs are
@@ -184,7 +186,7 @@ func NewProtocolManager(
noMorePeers: make(chan struct{}),
txsyncCh: make(chan *txsync),
quitSync: make(chan struct{}),
- receiveCh: make(chan coreTypes.Msg, 1024),
+ receiveCh: make(chan coreTypes.Msg, receiveChannelSize),
reportBadPeerChan: make(chan interface{}, 128),
receiveCoreMessage: 0,
isBlockProposer: isBlockProposer,
@@ -348,11 +350,7 @@ func (pm *ProtocolManager) ReceiveChan() <-chan coreTypes.Msg {
}
func (pm *ProtocolManager) sendCoreMsg(msg *coreTypes.Msg) {
- select {
- case pm.receiveCh <- *msg:
- default:
- log.Warn("ReceiveChan full, dropping", "message", msg)
- }
+ pm.receiveCh <- *msg
}
func (pm *ProtocolManager) ReportBadPeerChan() chan<- interface{} {