Skip to content

Commit

Permalink
Merge pull request #487 from nkryuchkov/fix/fail-if-tp-down
Browse files Browse the repository at this point in the history
Return non-zero status code if added transport is not up
  • Loading branch information
nkryuchkov authored Aug 18, 2020
2 parents 7adfb19 + b6eaa3c commit 29550cb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cmd/skywire-cli/commands/visor/transports.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ var addTpCmd = &cobra.Command{
logger.WithError(err).Fatalf("Failed to establish %v transport", transportType)
}

if !tp.IsUp {
logger.Fatalf("Established %v transport to %v with ID %v, but it isn't up", transportType, pk, tp.ID)
}

logger.Infof("Established %v transport to %v", transportType, pk)
} else {
transportTypes := []string{
Expand Down
4 changes: 2 additions & 2 deletions pkg/snet/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func (n *Network) Dial(ctx context.Context, network string, pk cipher.PubKey, po

conn, err := client.Dial(ctx, pk, port)
if err != nil {
return nil, fmt.Errorf("sudph client: %w", err)
return nil, fmt.Errorf("dial: %w", err)
}

log.Infof("Dialed %v, conn local address %q, remote address %q", network, conn.LocalAddr(), conn.RemoteAddr())
Expand All @@ -411,7 +411,7 @@ func (n *Network) Listen(network string, port uint16) (*Listener, error) {

lis, err := client.Listen(port)
if err != nil {
return nil, fmt.Errorf("sudph client: %w", err)
return nil, fmt.Errorf("listen: %w", err)
}

return makeListener(lis, network), nil
Expand Down
1 change: 1 addition & 0 deletions pkg/visor/rpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ func (rc *rpcClient) AddTransport(remote cipher.PubKey, tpType string, public bo
Public: public,
Timeout: timeout,
}, &summary)

return &summary, err
}

Expand Down

0 comments on commit 29550cb

Please sign in to comment.