Merge pull request #2561 from filecoin-project/feat/better-hello-logging
add some better logging for hello handshake failures
This commit is contained in:
commit
a33b5a9526
@ -5,6 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||
"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 {
|
||||
s, err := hs.h.NewStream(ctx, pid, ProtocolID)
|
||||
if err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("error opening stream: %w", err)
|
||||
}
|
||||
|
||||
hts := hs.cs.GetHeaviestTipSet()
|
||||
@ -149,7 +150,7 @@ func (hs *Service) SayHello(ctx context.Context, pid peer.ID) error {
|
||||
|
||||
t0 := build.Clock.Now()
|
||||
if err := cborutil.WriteCborRPC(s, hmsg); err != nil {
|
||||
return err
|
||||
return xerrors.Errorf("writing rpc to peer: %w", err)
|
||||
}
|
||||
|
||||
go func() {
|
||||
|
@ -41,7 +41,9 @@ func RunHello(mctx helpers.MetricsCtx, lc fx.Lifecycle, h host.Host, svc *hello.
|
||||
pic := evt.(event.EvtPeerIdentificationCompleted)
|
||||
go func() {
|
||||
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
|
||||
}
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user