Skip to content

Commit

Permalink
Network fixes (ssvlabs#804)
Browse files Browse the repository at this point in the history
* revert pre-handshake removal

* avoid logs in msg_id func
  • Loading branch information
amirylm authored Jan 11, 2023
1 parent c7714b1 commit 725b191
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions network/peers/connections/handshaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ func (h *handshaker) Handshake(conn libp2pnetwork.Conn) error {
if err != nil || ni != nil {
return err
}
//if err := h.preHandshake(conn); err != nil {
// return errors.Wrap(err, "could not perform pre-handshake")
//}
if err := h.preHandshake(conn); err != nil {
return errors.Wrap(err, "could not perform pre-handshake")
}
ni, err = h.nodeInfoFromStream(conn)
if err != nil {
// fallbacks to user agent
Expand Down
7 changes: 4 additions & 3 deletions network/topics/msg_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,19 @@ func (handler *msgIDHandler) MsgID() func(pmsg *ps_pb.Message) string {
if pmsg == nil {
return MsgIDEmptyMessage
}
logger := handler.logger.With(zap.ByteString("seq_no", pmsg.GetSeqno()))
//logger := handler.logger.With()
if len(pmsg.GetData()) == 0 {
return MsgIDEmptyMessage
}
pid, err := peer.IDFromBytes(pmsg.GetFrom())
if err != nil {
return MsgIDBadPeerID
}
logger = logger.With(zap.String("from", pid.String()))
mid := handler.fork.MsgID()(pmsg.GetData())
if len(mid) == 0 {
logger.Warn("could not create msg_id")
handler.logger.Debug("could not create msg_id",
zap.ByteString("seq_no", pmsg.GetSeqno()),
zap.String("from", pid.String()))
return MsgIDError
}
handler.Add(mid, pid)
Expand Down

0 comments on commit 725b191

Please sign in to comment.