remove some debugs

This commit is contained in:
Ethan Buchman 2017-12-19 00:57:28 -05:00
parent a86df17ceb
commit cb3ac6987e
5 changed files with 2 additions and 42 deletions

View File

@ -76,11 +76,8 @@ func (conR *ConsensusReactor) OnStart() error {
// OnStop implements BaseService
func (conR *ConsensusReactor) OnStop() {
conR.Logger.Debug("conR.OnStop")
conR.BaseReactor.OnStop()
conR.Logger.Debug("conR.OnStop: Stopping ConsensusState")
conR.conS.Stop()
conR.Logger.Debug("conR.OnStop: DONE")
}
// SwitchToConsensus switches from fast_sync mode to consensus mode.
@ -921,8 +918,6 @@ func (ps *PeerState) PickSendVote(votes types.VoteSetReader) bool {
msg := &VoteMessage{vote}
ps.logger.Debug("Sending vote message", "ps", ps, "vote", vote)
return ps.Peer.Send(VoteChannel, struct{ ConsensusMessage }{msg})
} else {
ps.logger.Debug("No vote message to send", "ps", ps)
}
return false
}

View File

@ -267,18 +267,14 @@ func (cs *ConsensusState) startRoutines(maxSteps int) {
// OnStop implements cmn.Service. It stops all routines and waits for the WAL to finish.
func (cs *ConsensusState) OnStop() {
cs.Logger.Debug("conS.OnStop")
cs.BaseService.OnStop()
cs.Logger.Debug("conS.OnStop: Stopping ticker")
cs.timeoutTicker.Stop()
// Make BaseService.Wait() wait until cs.wal.Wait()
cs.Logger.Debug("conS.OnStop: Waiting for WAL")
if cs.IsRunning() {
cs.wal.Wait()
}
cs.Logger.Debug("conS.OnStop: DONE")
}
// Wait waits for the the main routine to return.

View File

@ -185,19 +185,13 @@ func (c *MConnection) OnStart() error {
// OnStop implements BaseService
func (c *MConnection) OnStop() {
c.Logger.Debug("MConn.OnStop")
c.BaseService.OnStop()
c.Logger.Debug("MConn.flushTimer.Stop")
c.flushTimer.Stop()
c.Logger.Debug("MConn.pingTimer.Stop")
c.pingTimer.Stop()
c.Logger.Debug("MConn.chStatsTimer.Stop")
c.chStatsTimer.Stop()
if c.quit != nil {
c.Logger.Debug("MConn: Close Quit")
close(c.quit)
}
c.Logger.Debug("MConn.conn.Close()")
c.conn.Close() // nolint: errcheck
// We can't close pong safely here because
// recvRoutine may write to it after we've stopped.
@ -339,7 +333,6 @@ FOR_LOOP:
case <-c.send:
// Send some msgPackets
eof := c.sendSomeMsgPackets()
c.Logger.Debug("finished sendSomeMsgPackets", "eof", eof)
if !eof {
// Keep sendRoutine awake.
select {
@ -359,7 +352,6 @@ FOR_LOOP:
}
}
c.Logger.Debug("sendRoutine: End")
// Cleanup
}
@ -369,12 +361,10 @@ func (c *MConnection) sendSomeMsgPackets() bool {
// Block until .sendMonitor says we can write.
// Once we're ready we send more than we asked for,
// but amortized it should even out.
c.Logger.Debug("sendMonitor.Limit")
c.sendMonitor.Limit(c.config.maxMsgPacketTotalSize(), atomic.LoadInt64(&c.config.SendRate), true)
// Now send some msgPackets.
for i := 0; i < numBatchMsgPackets; i++ {
c.Logger.Debug("sendMsgPacket", "i", i)
if c.sendMsgPacket() {
return true
}
@ -403,7 +393,6 @@ func (c *MConnection) sendMsgPacket() bool {
// Nothing to send?
if leastChannel == nil {
c.Logger.Debug("Least channel == nil")
return true
} else {
// c.Logger.Info("Found a msgPacket to send")
@ -416,7 +405,6 @@ func (c *MConnection) sendMsgPacket() bool {
c.stopForError(err)
return true
}
c.Logger.Debug("sendMonitor.Update")
c.sendMonitor.Update(int(n))
c.flushTimer.Set()
return false
@ -430,7 +418,6 @@ func (c *MConnection) recvRoutine() {
FOR_LOOP:
for {
c.Logger.Debug("recvRoutine: recvMonitor.Limit")
// Block until .recvMonitor says we can read.
c.recvMonitor.Limit(c.config.maxMsgPacketTotalSize(), atomic.LoadInt64(&c.config.RecvRate), true)
@ -452,9 +439,7 @@ FOR_LOOP:
// Read packet type
var n int
var err error
c.Logger.Debug("recvRoutine: ReadByte")
pktType := wire.ReadByte(c.bufReader, &n, &err)
c.Logger.Debug("recvRoutine: recvMonitor.Update")
c.recvMonitor.Update(int(n))
if err != nil {
if c.IsRunning() {
@ -470,15 +455,12 @@ FOR_LOOP:
// TODO: prevent abuse, as they cause flush()'s.
c.Logger.Debug("Receive Ping")
c.pong <- struct{}{}
c.Logger.Debug("recvRoutine: trigger pong")
case packetTypePong:
// do nothing
c.Logger.Debug("Receive Pong")
case packetTypeMsg:
pkt, n, err := msgPacket{}, int(0), error(nil)
c.Logger.Debug("recvRoutine: ReadBinaryPtr")
wire.ReadBinaryPtr(&pkt, c.bufReader, c.config.maxMsgPacketTotalSize(), &n, &err)
c.Logger.Debug("recvRoutine: recvMonitor.Update")
c.recvMonitor.Update(int(n))
if err != nil {
if c.IsRunning() {
@ -494,9 +476,7 @@ FOR_LOOP:
c.stopForError(err)
}
c.Logger.Debug("recvRoutine: recvMsgPacket")
msgBytes, err := channel.recvMsgPacket(pkt)
c.Logger.Debug("recvRoutine: msgBytes", "msgBytes", msgBytes, "err", err)
if err != nil {
if c.IsRunning() {
c.Logger.Error("Connection failed @ recvRoutine", "conn", c, "err", err)
@ -508,7 +488,6 @@ FOR_LOOP:
c.Logger.Debug("Received bytes", "chID", pkt.ChannelID, "msgBytes", msgBytes)
// NOTE: This means the reactor.Receive runs in the same thread as the p2p recv routine
c.onReceive(pkt.ChannelID, msgBytes)
c.Logger.Debug("done onReceive")
}
default:
err := fmt.Errorf("Unknown message type %X", pktType)
@ -518,11 +497,8 @@ FOR_LOOP:
// TODO: shouldn't this go in the sendRoutine?
// Better to send a ping packet when *we* haven't sent anything for a while.
c.Logger.Debug("pingTimer.Reset()")
c.pingTimer.Reset()
c.Logger.Debug("done pingTimer.Reset()")
}
c.Logger.Debug("recvRoutine: End")
// Cleanup
close(c.pong)

View File

@ -237,9 +237,7 @@ func (p *peer) OnStart() error {
// OnStop implements BaseService.
func (p *peer) OnStop() {
p.Logger.Debug("Peer.OnStop")
p.BaseService.OnStop()
p.Logger.Debug("Peer.mconn.Stop")
p.mconn.Stop()
}

View File

@ -210,23 +210,18 @@ func (sw *Switch) OnStart() error {
// OnStop implements BaseService. It stops all listeners, peers, and reactors.
func (sw *Switch) OnStop() {
// Stop listeners
sw.Logger.Debug("Switch: Stopping listeners")
for _, listener := range sw.listeners {
listener.Stop()
}
sw.listeners = nil
// Stop peers
sw.Logger.Debug("Switch: Stopping Peers")
for i, peer := range sw.peers.List() {
sw.Logger.Debug("Switch: Stopping peer", "i", i, "peer", peer)
for _, peer := range sw.peers.List() {
peer.Stop()
sw.Logger.Debug("Switch: Removing peer", "i", i, "peer", peer)
sw.peers.Remove(peer)
}
// Stop reactors
sw.Logger.Debug("Switch: Stopping reactors")
for name, reactor := range sw.reactors {
sw.Logger.Debug("Switch: Stopping reactor", "name", name)
for _, reactor := range sw.reactors {
reactor.Stop()
}
}