Skip to content

Commit

Permalink
Remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
nkryuchkov committed Jul 5, 2019
1 parent 3472a3b commit 3c32708
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 28 deletions.
20 changes: 0 additions & 20 deletions pkg/setup/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"time"

"github.com/skycoin/dmsg/cipher"
Expand All @@ -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"
)

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pkg/setup/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
8 changes: 1 addition & 7 deletions pkg/transport/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand All @@ -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
}
Expand Down

0 comments on commit 3c32708

Please sign in to comment.