Skip to content

Commit

Permalink
comments from CR
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
  • Loading branch information
whyrusleeping committed Jun 11, 2015
1 parent c5b40b3 commit 9e8e6e5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions exchange/bitswap/wantmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ func (mq *msgQueue) runQueue(ctx context.Context) {
}

func (mq *msgQueue) doWork(ctx context.Context) {
// allow a minute for connections
// allow ten minutes for connections
// this includes looking them up in the dht
// dialing them, and handshaking
conctx, cancel := context.WithTimeout(ctx, time.Minute)
conctx, cancel := context.WithTimeout(ctx, time.Minute*10)
defer cancel()

err := mq.network.ConnectTo(conctx, mq.p)
Expand All @@ -161,14 +161,16 @@ func (mq *msgQueue) doWork(ctx context.Context) {
// grab outgoing message
mq.outlk.Lock()
wlm := mq.out
mq.out = nil
if wlm != nil && !wlm.Empty() {
mq.out = nil
}
mq.outlk.Unlock()

if wlm == nil || wlm.Empty() {
return
}

sendctx, cancel := context.WithTimeout(ctx, time.Second*30)
sendctx, cancel := context.WithTimeout(ctx, time.Minute*5)
defer cancel()

// send wantlist updates
Expand Down

0 comments on commit 9e8e6e5

Please sign in to comment.