Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 006b124

Browse files
committedMay 12, 2015
correctly buffer work messages
1 parent be01620 commit 006b124

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎exchange/bitswap/peermanager.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (pm *PeerManager) startPeerHandler(p peer.ID) {
7575

7676
mq := new(msgQueue)
7777
mq.done = make(chan struct{})
78-
mq.work = make(chan struct{})
78+
mq.work = make(chan struct{}, 1)
7979
mq.p = p
8080

8181
pm.peers[p] = mq
@@ -112,7 +112,7 @@ func (pm *PeerManager) runQueue(mq *msgQueue) {
112112
mq.wlmsg = nil
113113
mq.lk.Unlock()
114114

115-
if !wlm.Empty() {
115+
if wlm != nil && !wlm.Empty() {
116116
// send wantlist updates
117117
err = pm.network.SendMessage(context.TODO(), mq.p, wlm)
118118
if err != nil {

0 commit comments

Comments
 (0)
Please sign in to comment.