From 3c3270894a569971c4e59596cb07fd208124d2da Mon Sep 17 00:00:00 2001 From: Nikita Kryuchkov Date: Fri, 5 Jul 2019 10:52:44 +0300 Subject: [PATCH] Remove unnecessary code --- pkg/setup/node.go | 20 -------------------- pkg/setup/node_test.go | 2 +- pkg/transport/manager.go | 8 +------- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/pkg/setup/node.go b/pkg/setup/node.go index 44cedde2a..59acd865b 100644 --- a/pkg/setup/node.go +++ b/pkg/setup/node.go @@ -5,7 +5,6 @@ import ( "encoding/json" "errors" "fmt" - "log" "time" "github.com/skycoin/dmsg/cipher" @@ -15,7 +14,6 @@ import ( "github.com/skycoin/skywire/pkg/metrics" "github.com/skycoin/skywire/pkg/routing" "github.com/skycoin/skywire/pkg/transport" - trClient "github.com/skycoin/skywire/pkg/transport-discovery/client" "github.com/skycoin/skywire/pkg/transport/dmsg" ) @@ -44,24 +42,6 @@ func NewNode(conf *Config, metrics metrics.Recorder) (*Node, error) { } messenger := dmsg.NewClient(pk, sk, disc.NewHTTP(conf.Messaging.Discovery), dmsg.SetLogger(logger.PackageLogger(dmsg.Type))) - trDiscovery, err := trClient.NewHTTP(conf.TransportDiscovery, pk, sk) - if err != nil { - return nil, fmt.Errorf("trdiscovery: %s", err) - } - - tmConf := &transport.ManagerConfig{ - PubKey: pk, - SecKey: sk, - DiscoveryClient: trDiscovery, - LogStore: transport.InMemoryTransportLogStore(), - } - - tm, err := transport.NewManager(tmConf, messenger) - if err != nil { - log.Fatal("Failed to setup Transport Manager: ", err) - } - tm.Logger = logger.PackageLogger("trmanager") - return &Node{ Logger: logger.PackageLogger("routesetup"), metrics: metrics, diff --git a/pkg/setup/node_test.go b/pkg/setup/node_test.go index 48a902c0a..d45b3d659 100644 --- a/pkg/setup/node_test.go +++ b/pkg/setup/node_test.go @@ -62,7 +62,7 @@ func TestCreateLoop(t *testing.T) { _, err := c1.Dial(context.TODO(), pk2) require.NoError(t, err) - _, err = c3.Dial(context.TODO(), pk2) + _, err = c3.Dial(context.TODO(), pk4) require.NoError(t, err) l := &routing.Loop{LocalPort: 1, RemotePort: 2, Expiry: time.Now().Add(time.Hour), diff --git a/pkg/transport/manager.go b/pkg/transport/manager.go index 5f5ca6caf..c7f4678ba 100644 --- a/pkg/transport/manager.go +++ b/pkg/transport/manager.go @@ -255,7 +255,6 @@ func (tm *Manager) Close() error { } func (tm *Manager) dialTransport(ctx context.Context, factory Factory, remote cipher.PubKey, public bool) (Transport, *Entry, error) { - if tm.isClosing() { return nil, nil, errors.New("transport.Manager is closing. Skipping dialing transport") } @@ -265,16 +264,11 @@ func (tm *Manager) dialTransport(ctx context.Context, factory Factory, remote ci return nil, nil, err } - var entry *Entry - // if tm.IsSetupTransport(tr) { - // entry = makeEntry(tr, public) - // } else { - entry, err = settlementInitiatorHandshake(public).Do(tm, tr, time.Minute) + entry, err := settlementInitiatorHandshake(public).Do(tm, tr, time.Minute) if err != nil { tr.Close() return nil, nil, err } - // } return tr, entry, nil }