Browse Source

set logger for peer's MConnection

pull/834/head
Anton Kaliaev 7 years ago
parent
commit
a1cdc2b68a
No known key found for this signature in database GPG Key ID: 7B6881D965918214
2 changed files with 6 additions and 1 deletions
  1. +0
    -1
      consensus/reactor.go
  2. +6
    -0
      p2p/peer.go

+ 0
- 1
consensus/reactor.go View File

@ -390,7 +390,6 @@ func (conR *ConsensusReactor) broadcastProposalHeartbeatMessage(heartbeat types.
} }
func (conR *ConsensusReactor) broadcastNewRoundStep(rs *cstypes.RoundState) { func (conR *ConsensusReactor) broadcastNewRoundStep(rs *cstypes.RoundState) {
nrsMsg, csMsg := makeRoundStepMessages(rs) nrsMsg, csMsg := makeRoundStepMessages(rs)
if nrsMsg != nil { if nrsMsg != nil {
conR.Switch.Broadcast(StateChannel, struct{ ConsensusMessage }{nrsMsg}) conR.Switch.Broadcast(StateChannel, struct{ ConsensusMessage }{nrsMsg})


+ 6
- 0
p2p/peer.go View File

@ -11,6 +11,7 @@ import (
crypto "github.com/tendermint/go-crypto" crypto "github.com/tendermint/go-crypto"
wire "github.com/tendermint/go-wire" wire "github.com/tendermint/go-wire"
cmn "github.com/tendermint/tmlibs/common" cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
) )
// Peer is an interface representing a peer connected on a reactor. // Peer is an interface representing a peer connected on a reactor.
@ -136,6 +137,11 @@ func newPeerFromConnAndConfig(rawConn net.Conn, outbound bool, reactorsByCh map[
return p, nil return p, nil
} }
func (p *peer) SetLogger(l log.Logger) {
p.Logger = l
p.mconn.SetLogger(l)
}
// CloseConn should be used when the peer was created, but never started. // CloseConn should be used when the peer was created, but never started.
func (p *peer) CloseConn() { func (p *peer) CloseConn() {
p.conn.Close() p.conn.Close()


Loading…
Cancel
Save