Skip to content

Commit

Permalink
Updated error reporting when registering tp during settlement HS.
Browse files Browse the repository at this point in the history
  • Loading branch information
志宇 committed Mar 4, 2020
1 parent 8341370 commit 6164331
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/SkycoinProject/skywire-mainnet
go 1.13

require (
github.com/SkycoinProject/dmsg v0.0.0-20200304081751-cf4d40f5428f
github.com/SkycoinProject/dmsg v0.0.0-20200304115237-130cc9d98ffb
github.com/SkycoinProject/skycoin v0.27.0
github.com/SkycoinProject/yamux v0.0.0-20191213015001-a36efeefbf6a
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/SkycoinProject/dmsg v0.0.0-20200304081751-cf4d40f5428f h1:NvirKQPrsp9xrJItJfmRwhfY7atS/AuzdGmJ76m703M=
github.com/SkycoinProject/dmsg v0.0.0-20200304081751-cf4d40f5428f/go.mod h1:DzykXMLlx6Fx0fGjZsCIRas/MIvxW8DZpmDA6f2nCRk=
github.com/SkycoinProject/dmsg v0.0.0-20200304115237-130cc9d98ffb h1:UPgo4kZ/nFV4jI9djG0esOyZjda4IZGZpGl/ntYRyuM=
github.com/SkycoinProject/dmsg v0.0.0-20200304115237-130cc9d98ffb/go.mod h1:DzykXMLlx6Fx0fGjZsCIRas/MIvxW8DZpmDA6f2nCRk=
github.com/SkycoinProject/skycoin v0.26.0/go.mod h1:xqPLOKh5B6GBZlGA7B5IJfQmCy7mwimD9NlqxR3gMXo=
github.com/SkycoinProject/skycoin v0.27.0 h1:N3IHxj8ossHOcsxLYOYugT+OaELLncYHJHxbbYLPPmY=
github.com/SkycoinProject/skycoin v0.27.0/go.mod h1:xqPLOKh5B6GBZlGA7B5IJfQmCy7mwimD9NlqxR3gMXo=
Expand Down
9 changes: 8 additions & 1 deletion pkg/transport/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import (
"errors"
"fmt"
"io"
"net/http"

"github.com/SkycoinProject/dmsg/cipher"
"github.com/SkycoinProject/dmsg/httputil"

"github.com/SkycoinProject/skywire-mainnet/pkg/snet"
)
Expand Down Expand Up @@ -130,7 +132,12 @@ func MakeSettlementHS(init bool) SettlementHS {

// Ensure transport is registered.
if err := dc.RegisterTransports(ctx, recvSE); err != nil {
log.WithError(err).Error("Failed to register transports")
if httpErr, ok := err.(*httputil.HTTPError); ok && httpErr.Status == http.StatusConflict {
log.WithError(err).Debug("An expected error occurred while trying to register transport.")
} else {
// TODO(evanlinjin): Once tpDisc is updated, this should return error and result in failed HS.
log.WithError(err).Error("Failed to register transport.")
}
}

// inform initiating visor.
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/SkycoinProject/dmsg/httputil/error.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# github.com/SkycoinProject/dmsg v0.0.0-20200304081751-cf4d40f5428f
# github.com/SkycoinProject/dmsg v0.0.0-20200304115237-130cc9d98ffb
github.com/SkycoinProject/dmsg
github.com/SkycoinProject/dmsg/cipher
github.com/SkycoinProject/dmsg/disc
Expand Down

0 comments on commit 6164331

Please sign in to comment.