Skip to content

Commit

Permalink
Updated the prints for stream
Browse files Browse the repository at this point in the history
  • Loading branch information
gameofpointers committed Oct 30, 2024
1 parent bf31249 commit 024fcff
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
8 changes: 4 additions & 4 deletions p2p/node/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,15 +225,15 @@ func (p *P2PNode) requestAndWait(peerID peer.ID, topic *pubsubManager.Topic, req
log.Global.WithFields(log.Fields{
"peerId": peerID,
"message": "Request timed out, data not received",
}).Warning("Missed data request")
}).Info("Success Missed data request")
// Mark this peer as not responding
p.peerManager.AdjustPeerQuality(peerID, topic.String(), p2p.QualityAdjOnTimeout)
default:
// Optionally log the missed send or handle it in another way
log.Global.WithFields(log.Fields{
"peerId": peerID,
"message": "Channel is full, data not sent",
}).Warning("Missed data send")
}).Info("Success Missed data send")
}
} else {
if err.Error() == streamManager.ErrStreamNotFound.Error() {
Expand All @@ -242,8 +242,8 @@ func (p *P2PNode) requestAndWait(peerID peer.ID, topic *pubsubManager.Topic, req
log.Global.WithFields(log.Fields{
"peerId": peerID,
"topic": topic.String(),
"err": err,
}).Error("Error requesting the data from peer")
"info": err,
}).Info("Success requesting the data from peer")
}
}

Expand Down
2 changes: 1 addition & 1 deletion p2p/node/p2p_services.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (p *P2PNode) requestFromPeer(peerID peer.ID, topic *pubsubManager.Topic, re
log.Global.WithFields(log.Fields{
"requestID": id,
"peerId": peerID,
}).Warn("Peer did not respond in time")
}).Info("Success Peer did not respond in time")
p.peerManager.AdjustPeerQuality(peerID, topic.String(), p2p.QualityAdjOnTimeout)
return nil, errors.New("peer did not respond in time")
}
Expand Down
2 changes: 0 additions & 2 deletions p2p/node/peerManager/peerdb/counter.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package peerdb

import (
"github.com/dominant-strategies/go-quai/log"
"github.com/syndtr/goleveldb/leveldb"
)

Expand All @@ -26,7 +25,6 @@ func (pdb *PeerDB) decrementPeerCount() {
pdb.mu.Lock()
defer pdb.mu.Unlock()
if pdb.peerCounter == 0 {
log.Global.Errorf("Peer counter is already at 0")
return
}
pdb.peerCounter--
Expand Down
4 changes: 2 additions & 2 deletions p2p/node/streamManager/streamManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func (sm *basicStreamManager) listenForNewStreamRequest() {
go func(peerID peer.ID) {
err := sm.OpenStream(peerID)
if err != nil {
log.Global.WithFields(log.Fields{"peerId": peerID, "err": err}).Warn("Error opening new stream into peer")
log.Global.WithFields(log.Fields{"peerId": peerID, "info": err}).Info("Success opening new stream into peer")
}
}(peerID)

Expand Down Expand Up @@ -209,7 +209,7 @@ func (sm *basicStreamManager) GetStream(peerID p2p.PeerID) (network.Stream, erro
}
return nil, ErrStreamNotFound
} else {
log.Global.WithField("PeerID", peerID).Info("Requested stream was found in cache")
log.Global.WithField("PeerID", peerID).Debug("Requested stream was found in cache")
}

return wrappedStream.stream, err
Expand Down

0 comments on commit 024fcff

Please sign in to comment.