comments from CR

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy 2015-06-11 13:34:11 -07:00
parent c5b40b3b02
commit e014a66bf5

View File

@ -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)
@ -161,14 +161,14 @@ func (mq *msgQueue) doWork(ctx context.Context) {
// grab outgoing message
mq.outlk.Lock()
wlm := mq.out
if wlm == nil || wlm.Empty() {
mq.outlk.Unlock()
return
}
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