swarm/network: more logs

This commit is contained in:
Anton Evangelatov 2019-03-11 11:11:39 +01:00
parent 6e7af784dc
commit 6907db269f
3 changed files with 7 additions and 6 deletions

View file

@ -26,7 +26,7 @@ import (
"github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/enode"
"github.com/ethereum/go-ethereum/swarm/storage" "github.com/ethereum/go-ethereum/swarm/storage"
"github.com/ethereum/go-ethereum/swarm/tracing" "github.com/ethereum/go-ethereum/swarm/tracing"
"github.com/opentracing/opentracing-go" olog "github.com/opentracing/opentracing-go/log"
) )
const ( const (
@ -327,7 +327,8 @@ func (f *Fetcher) doRequest(gone chan *enode.ID, peersToSkip *sync.Map, sources
span := tracing.ShiftSpanByKey(spanId) span := tracing.ShiftSpanByKey(spanId)
if span != nil { if span != nil {
defer span.(opentracing.Span).Finish() span.LogFields(olog.String("finish", "from doRequest"))
span.Finish()
} }
}() }()
return sources, nil return sources, nil

View file

@ -225,7 +225,8 @@ func (d *Delivery) handleChunkDeliveryMsg(ctx context.Context, sp *Peer, req *Ch
go func() { go func() {
if span != nil { if span != nil {
defer span.(opentracing.Span).Finish() span.LogFields(olog.String("finish", "from handleChunkDeliveryMsg"))
defer span.Finish()
} }
req.peer = sp req.peer = sp

View file

@ -167,9 +167,8 @@ func (p *Peer) SendPriority(ctx context.Context, msg interface{}, priority uint8
Msg: msg, Msg: msg,
} }
err := p.pq.Push(wmsg, int(priority)) err := p.pq.Push(wmsg, int(priority))
if err == pq.ErrContention { if err != nil {
log.Warn("dropping peer on priority queue contention", "peer", p.ID()) log.Error("err on p.pq.Push", "err", err, "peer", p.ID())
p.Drop(err)
} }
return err return err
} }