add some better logging for hello handshake failures
This commit is contained in:
parent
474ab02d44
commit
0594177191
@ -5,6 +5,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
xerrors "golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -125,7 +126,7 @@ func (hs *Service) HandleStream(s inet.Stream) {
|
|||||||
func (hs *Service) SayHello(ctx context.Context, pid peer.ID) error {
|
func (hs *Service) SayHello(ctx context.Context, pid peer.ID) error {
|
||||||
s, err := hs.h.NewStream(ctx, pid, ProtocolID)
|
s, err := hs.h.NewStream(ctx, pid, ProtocolID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return xerrors.Errorf("error opening stream: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
hts := hs.cs.GetHeaviestTipSet()
|
hts := hs.cs.GetHeaviestTipSet()
|
||||||
@ -149,7 +150,7 @@ func (hs *Service) SayHello(ctx context.Context, pid peer.ID) error {
|
|||||||
|
|
||||||
t0 := build.Clock.Now()
|
t0 := build.Clock.Now()
|
||||||
if err := cborutil.WriteCborRPC(s, hmsg); err != nil {
|
if err := cborutil.WriteCborRPC(s, hmsg); err != nil {
|
||||||
return err
|
return xerrors.Errorf("writing rpc to peer: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -41,7 +41,9 @@ func RunHello(mctx helpers.MetricsCtx, lc fx.Lifecycle, h host.Host, svc *hello.
|
|||||||
pic := evt.(event.EvtPeerIdentificationCompleted)
|
pic := evt.(event.EvtPeerIdentificationCompleted)
|
||||||
go func() {
|
go func() {
|
||||||
if err := svc.SayHello(helpers.LifecycleCtx(mctx, lc), pic.Peer); err != nil {
|
if err := svc.SayHello(helpers.LifecycleCtx(mctx, lc), pic.Peer); err != nil {
|
||||||
log.Warnw("failed to say hello", "error", err, "peer", pic.Peer)
|
protos, _ := h.Peerstore().GetProtocols(pic.Peer)
|
||||||
|
agent, _ := h.Peerstore().Get(pic.Peer, "AgentVersion")
|
||||||
|
log.Warnw("failed to say hello", "error", err, "peer", pic.Peer, "supported", protos, "agent", agent)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user