mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-15 06:11:20 +00:00
more logging
This commit is contained in:
@ -333,6 +333,7 @@ FOR_LOOP:
|
|||||||
case <-c.send:
|
case <-c.send:
|
||||||
// Send some msgPackets
|
// Send some msgPackets
|
||||||
eof := c.sendSomeMsgPackets()
|
eof := c.sendSomeMsgPackets()
|
||||||
|
c.logger.Debug("finished sendSomeMsgPackets", "eof", eof)
|
||||||
if !eof {
|
if !eof {
|
||||||
// Keep sendRoutine awake.
|
// Keep sendRoutine awake.
|
||||||
select {
|
select {
|
||||||
@ -352,6 +353,7 @@ FOR_LOOP:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.logger.Debug("sendRoutine: End")
|
||||||
// Cleanup
|
// Cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,10 +363,12 @@ func (c *MConnection) sendSomeMsgPackets() bool {
|
|||||||
// Block until .sendMonitor says we can write.
|
// Block until .sendMonitor says we can write.
|
||||||
// Once we're ready we send more than we asked for,
|
// Once we're ready we send more than we asked for,
|
||||||
// but amortized it should even out.
|
// but amortized it should even out.
|
||||||
|
c.Logger.Debug("sendMonitor.Limit")
|
||||||
c.sendMonitor.Limit(c.config.maxMsgPacketTotalSize(), atomic.LoadInt64(&c.config.SendRate), true)
|
c.sendMonitor.Limit(c.config.maxMsgPacketTotalSize(), atomic.LoadInt64(&c.config.SendRate), true)
|
||||||
|
|
||||||
// Now send some msgPackets.
|
// Now send some msgPackets.
|
||||||
for i := 0; i < numBatchMsgPackets; i++ {
|
for i := 0; i < numBatchMsgPackets; i++ {
|
||||||
|
c.Logger.Debug("sendMsgPacket", "i", i)
|
||||||
if c.sendMsgPacket() {
|
if c.sendMsgPacket() {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -406,6 +410,7 @@ func (c *MConnection) sendMsgPacket() bool {
|
|||||||
c.stopForError(err)
|
c.stopForError(err)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
c.logger.Debug("sendMonitor.Update")
|
||||||
c.sendMonitor.Update(int(n))
|
c.sendMonitor.Update(int(n))
|
||||||
c.flushTimer.Set()
|
c.flushTimer.Set()
|
||||||
return false
|
return false
|
||||||
@ -419,6 +424,7 @@ func (c *MConnection) recvRoutine() {
|
|||||||
|
|
||||||
FOR_LOOP:
|
FOR_LOOP:
|
||||||
for {
|
for {
|
||||||
|
c.logger.Debug("recvRoutine: recvMonitor.Limit")
|
||||||
// Block until .recvMonitor says we can read.
|
// Block until .recvMonitor says we can read.
|
||||||
c.recvMonitor.Limit(c.config.maxMsgPacketTotalSize(), atomic.LoadInt64(&c.config.RecvRate), true)
|
c.recvMonitor.Limit(c.config.maxMsgPacketTotalSize(), atomic.LoadInt64(&c.config.RecvRate), true)
|
||||||
|
|
||||||
@ -440,7 +446,9 @@ FOR_LOOP:
|
|||||||
// Read packet type
|
// Read packet type
|
||||||
var n int
|
var n int
|
||||||
var err error
|
var err error
|
||||||
|
c.logger.Debug("recvRoutine: ReadByte")
|
||||||
pktType := wire.ReadByte(c.bufReader, &n, &err)
|
pktType := wire.ReadByte(c.bufReader, &n, &err)
|
||||||
|
c.logger.Debug("recvRoutine: recvMonitor.Update")
|
||||||
c.recvMonitor.Update(int(n))
|
c.recvMonitor.Update(int(n))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if c.IsRunning() {
|
if c.IsRunning() {
|
||||||
@ -456,12 +464,15 @@ FOR_LOOP:
|
|||||||
// TODO: prevent abuse, as they cause flush()'s.
|
// TODO: prevent abuse, as they cause flush()'s.
|
||||||
c.Logger.Debug("Receive Ping")
|
c.Logger.Debug("Receive Ping")
|
||||||
c.pong <- struct{}{}
|
c.pong <- struct{}{}
|
||||||
|
c.logger.Debug("recvRoutine: trigger pong")
|
||||||
case packetTypePong:
|
case packetTypePong:
|
||||||
// do nothing
|
// do nothing
|
||||||
c.Logger.Debug("Receive Pong")
|
c.Logger.Debug("Receive Pong")
|
||||||
case packetTypeMsg:
|
case packetTypeMsg:
|
||||||
pkt, n, err := msgPacket{}, int(0), error(nil)
|
pkt, n, err := msgPacket{}, int(0), error(nil)
|
||||||
|
c.logger.Debug("recvRoutine: ReadBinaryPtr")
|
||||||
wire.ReadBinaryPtr(&pkt, c.bufReader, c.config.maxMsgPacketTotalSize(), &n, &err)
|
wire.ReadBinaryPtr(&pkt, c.bufReader, c.config.maxMsgPacketTotalSize(), &n, &err)
|
||||||
|
c.logger.Debug("recvRoutine: recvMonitor.Update")
|
||||||
c.recvMonitor.Update(int(n))
|
c.recvMonitor.Update(int(n))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if c.IsRunning() {
|
if c.IsRunning() {
|
||||||
@ -477,7 +488,9 @@ FOR_LOOP:
|
|||||||
c.stopForError(err)
|
c.stopForError(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.logger.Debug("recvRoutine: recvMsgPacket")
|
||||||
msgBytes, err := channel.recvMsgPacket(pkt)
|
msgBytes, err := channel.recvMsgPacket(pkt)
|
||||||
|
c.logger.Debug("recvRoutine: msgBytes", "msgBytes", msgBytes, "err", err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if c.IsRunning() {
|
if c.IsRunning() {
|
||||||
c.Logger.Error("Connection failed @ recvRoutine", "conn", c, "err", err)
|
c.Logger.Error("Connection failed @ recvRoutine", "conn", c, "err", err)
|
||||||
@ -500,6 +513,7 @@ FOR_LOOP:
|
|||||||
// Better to send a ping packet when *we* haven't sent anything for a while.
|
// Better to send a ping packet when *we* haven't sent anything for a while.
|
||||||
c.pingTimer.Reset()
|
c.pingTimer.Reset()
|
||||||
}
|
}
|
||||||
|
c.logger.Debug("recvRoutine: End")
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
close(c.pong)
|
close(c.pong)
|
||||||
|
Reference in New Issue
Block a user