From f0a4c63f7aff2699f213d176361ac638ebc8e82a Mon Sep 17 00:00:00 2001 From: lash Date: Wed, 20 Feb 2019 07:31:10 +0100 Subject: [PATCH] swarm/network, swarm/storage, swarm:tracing: Minor cleanup --- swarm/network/stream/peer.go | 2 -- swarm/network/stream/stream.go | 7 ------- swarm/storage/netstore.go | 2 +- swarm/tracing/tracing.go | 2 +- 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/swarm/network/stream/peer.go b/swarm/network/stream/peer.go index bcefdd7ae5..c59799e08a 100644 --- a/swarm/network/stream/peer.go +++ b/swarm/network/stream/peer.go @@ -66,7 +66,6 @@ type Peer struct { // on creating a new client in offered hashes handler. clientParams map[Stream]*clientParams quit chan struct{} - spans sync.Map } type WrappedPriorityMsg struct { @@ -84,7 +83,6 @@ func NewPeer(peer *protocols.Peer, streamer *Registry) *Peer { clients: make(map[Stream]*client), clientParams: make(map[Stream]*clientParams), quit: make(chan struct{}), - //spans: sync.Map{}, } ctx, cancel := context.WithCancel(context.Background()) go p.pq.Run(ctx, func(i interface{}) { diff --git a/swarm/network/stream/stream.go b/swarm/network/stream/stream.go index b8e686cb8a..83a0b141f2 100644 --- a/swarm/network/stream/stream.go +++ b/swarm/network/stream/stream.go @@ -35,8 +35,6 @@ import ( "github.com/ethereum/go-ethereum/swarm/network/stream/intervals" "github.com/ethereum/go-ethereum/swarm/state" "github.com/ethereum/go-ethereum/swarm/storage" - - opentracing "github.com/opentracing/opentracing-go" ) const ( @@ -97,7 +95,6 @@ type Registry struct { spec *protocols.Spec //this protocol's spec balance protocols.Balance //implements protocols.Balance, for accounting prices protocols.Prices //implements protocols.Prices, provides prices to accounting - spans sync.Map } // RegistryOptions holds optional values for NewRegistry constructor. @@ -887,10 +884,6 @@ func (r *Registry) Start(server *p2p.Server) error { } func (r *Registry) Stop() error { - r.spans.Range(func(k, v interface{}) bool { - v.(opentracing.Span).Finish() - return true - }) return nil } diff --git a/swarm/storage/netstore.go b/swarm/storage/netstore.go index 2e84f2ae0d..8a44f51a88 100644 --- a/swarm/storage/netstore.go +++ b/swarm/storage/netstore.go @@ -1,4 +1,4 @@ -//// Copyright 2016 The go-ethereum Authors +// Copyright 2016 The go-ethereum Authors // This file is part of the go-ethereum library. // // The go-ethereum library is free software: you can redistribute it and/or modify diff --git a/swarm/tracing/tracing.go b/swarm/tracing/tracing.go index 76a618477e..55875464b9 100644 --- a/swarm/tracing/tracing.go +++ b/swarm/tracing/tracing.go @@ -166,7 +166,7 @@ func ShiftSpanByKey(k string) opentracing.Span { // FinishSpans calls `Finish()` on all stored spans // It should be called on instance shutdown func FinishSpans() { - store.spans.Range(func(k, v interface{}) bool { + store.spans.Range(func(_, v interface{}) bool { v.(opentracing.Span).Finish() return true })