Skip to content

Commit

Permalink
Merged with mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
ayuryshev committed Apr 5, 2019
1 parent a71ab9b commit e867da6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ check: lint test ## Run linters and tests
build: dep host-apps bin ## Install dependencies, build apps and binaries. `go build` with ${OPTS}

run: stop build config ## Run skywire-node on host
./skywire-node
./skywire-node skywire.json

stop: ## Stop running skywire-node on host
-bash -c "kill $$(ps aux |grep '[s]kywire-node' |awk '{print $$2}')"

config: ## Generate skywire.json
-./skywire-cli gen-config -o ./skywire.json -r
-./skywire-cli node gen-config -o ./skywire.json -r

clean: ## Clean project: remove created binaries and apps
-rm -rf ./apps
Expand All @@ -33,6 +33,12 @@ clean: ## Clean project: remove created binaries and apps
install: ## Install `skywire-node`, `skywire-cli`, `manager-node`, `therealssh-cli`
${OPTS} go install ./cmd/skywire-node ./cmd/skywire-cli ./cmd/manager-node ./cmd/therealssh-cli

rerun: stop
${OPTS} go build -race -o ./skywire-node ./cmd/skywire-node
-./skywire-cli node gen-config -o ./skywire.json -r
perl -pi -e 's/localhost//g' ./skywire.json
./skywire-node skywire.json


lint: ## Run linters. Use make install-linters first
${OPTS} golangci-lint run -c .golangci.yml ./...
Expand Down Expand Up @@ -138,7 +144,8 @@ docker-bin: ## Build `skywire-node`, `skywire-cli`, `manager-node`, `therealssh-
${DOCKER_OPTS} go build -race -o ./node/skywire-node ./cmd/skywire-node

docker-volume: docker-apps docker-bin bin ## Prepare docker volume for dockerized skywire-node
-./skywire-cli gen-config -o ./node/skywire.json
-./skywire-cli node gen-config -o ./node/skywire.json -r
perl -pi -e 's/localhost//g' ./node/skywire.json # To make node accessible from outside with skywire-cli

docker-run: docker-clean docker-image docker-network docker-volume ## Run dockerized skywire-node ${DOCKER_NODE} in image ${DOCKER_IMAGE} with network ${DOCKER_NETWORK}
docker run -it -v $(shell pwd)/node:/sky --network=${DOCKER_NETWORK} \
Expand All @@ -147,6 +154,12 @@ docker-run: docker-clean docker-image docker-network docker-volume ## Run docker
docker-stop: ## Stop running dockerized skywire-node ${DOCKER_NODE}
-docker container stop ${DOCKER_NODE}

docker-rerun: docker-stop
-./skywire-cli gen-config -o ./node/skywire.json -r
perl -pi -e 's/localhost//g' ./node/skywire.json # To make node accessible from outside with skywire-cli
${DOCKER_OPTS} go build -race -o ./node/skywire-node ./cmd/skywire-node
docker container start -i ${DOCKER_NODE}


help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
Expand Down
2 changes: 1 addition & 1 deletion cmd/skywire-cli/commands/tpdisc/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func printTransportEntries(entries ...*transport.EntryWithStatus) {
internal.Catch(err)
for _, e := range entries {
_, err := fmt.Fprintf(w, "%s\t%s\t%t\t%d\t%t\t%s\t%s\t%t\t%t\n",
e.Entry.ID, e.Entry.Type, e.Entry.Public, e.Registered, e.IsUp, e.Entry.Edges[0], e.Entry.Edges[1], e.Statuses[0], e.Statuses[1])
e.Entry.ID, e.Entry.Type, e.Entry.Public, e.Registered, e.IsUp, e.Entry.Edges()[0], e.Entry.Edges()[1], e.Statuses[0], e.Statuses[1])
internal.Catch(err)
}
internal.Catch(w.Flush())
Expand Down
1 change: 1 addition & 0 deletions pkg/messaging/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ func (c *Client) Accept(ctx context.Context) (transport.Transport, error) {
func (c *Client) Dial(ctx context.Context, remote cipher.PubKey) (transport.Transport, error) {
entry, err := c.dc.Entry(ctx, remote)
if err != nil {
fmt.Printf("Dial with remote = %v\n", remote)
return nil, fmt.Errorf("get entry failure: %s", err)
}

Expand Down
1 change: 0 additions & 1 deletion pkg/transport/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ func (handshake settlementHandshake) Do(tm *Manager, tr Transport, timeout time.
var entry *Entry
errCh := make(chan error, 1)
go func() {
fmt.Printf("IMMA HERE")
e, err := handshake(tm, tr)
entry = e
errCh <- err
Expand Down
8 changes: 8 additions & 0 deletions pkg/transport/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package transport
import (
"context"
"errors"
"fmt"
"math/big"
"strings"
"sync"
Expand Down Expand Up @@ -347,6 +348,13 @@ func (tm *Manager) createTransport(ctx context.Context, remote cipher.PubKey, tp
}

func (tm *Manager) dialTransport(ctx context.Context, factory Factory, remote cipher.PubKey, public bool) (Transport, *Entry, error) {

fmt.Printf("Manager.dialTransport: %v %v\n", tm.Local(), remote)

if tm.Local() == remote {
fmt.Println("local and remote are equal. No need to dial")
}

tr, err := factory.Dial(ctx, remote)
if err != nil {
return nil, nil, err
Expand Down

0 comments on commit e867da6

Please sign in to comment.