Browse Source

blockchain parameter && log tweaks

pull/139/merge
Jae Kwon 9 years ago
parent
commit
1c17ea3b14
5 changed files with 9 additions and 7 deletions
  1. +4
    -2
      blockchain/pool.go
  2. +1
    -1
      blockchain/reactor.go
  3. +1
    -1
      p2p/connection.go
  4. +2
    -2
      p2p/peer.go
  5. +1
    -1
      scripts/unsafe_reset_net.sh

+ 4
- 2
blockchain/pool.go View File

@ -14,8 +14,8 @@ const (
requestIntervalMS = 500 requestIntervalMS = 500
maxTotalRequests = 300 maxTotalRequests = 300
maxPendingRequests = maxTotalRequests maxPendingRequests = maxTotalRequests
maxPendingRequestsPerPeer = 30
peerTimeoutSeconds = 10
maxPendingRequestsPerPeer = 50
peerTimeoutSeconds = 15
minRecvRate = 10240 // 10Kb/s minRecvRate = 10240 // 10Kb/s
) )
@ -103,6 +103,7 @@ func (pool *BlockPool) removeTimedoutPeers() {
// XXX remove curRate != 0 // XXX remove curRate != 0
if curRate != 0 && curRate < minRecvRate { if curRate != 0 && curRate < minRecvRate {
pool.sendTimeout(peer.id) pool.sendTimeout(peer.id)
log.Warn("SendTimeout", "peer", peer.id, "reason", "curRate too low")
peer.didTimeout = true peer.didTimeout = true
} }
} }
@ -363,6 +364,7 @@ func (bpp *bpPeer) decrPending(recvSize int) {
func (bpp *bpPeer) onTimeout() { func (bpp *bpPeer) onTimeout() {
bpp.pool.sendTimeout(bpp.id) bpp.pool.sendTimeout(bpp.id)
log.Warn("SendTimeout", "peer", bpp.id, "reason", "onTimeout")
bpp.didTimeout = true bpp.didTimeout = true
} }


+ 1
- 1
blockchain/reactor.go View File

@ -124,7 +124,7 @@ func (bcR *BlockchainReactor) Receive(chID byte, src *p2p.Peer, msgBytes []byte)
return return
} }
log.Notice("Received message", "msg", msg)
log.Notice("Received message", "src", src, "chID", chID, "msg", msg)
switch msg := msg.(type) { switch msg := msg.(type) {
case *bcBlockRequestMessage: case *bcBlockRequestMessage:


+ 1
- 1
p2p/connection.go View File

@ -585,7 +585,7 @@ func (ch *Channel) writeMsgPacketTo(w io.Writer) (n int64, err error) {
// Handles incoming msgPackets. Returns a msg bytes if msg is complete. // Handles incoming msgPackets. Returns a msg bytes if msg is complete.
// Not goroutine-safe // Not goroutine-safe
func (ch *Channel) recvMsgPacket(packet msgPacket) ([]byte, error) { func (ch *Channel) recvMsgPacket(packet msgPacket) ([]byte, error) {
log.Debug("Read Msg Packet", "conn", ch.conn, "packet", packet)
// log.Debug("Read Msg Packet", "conn", ch.conn, "packet", packet)
if wire.MaxBinaryReadSize < len(ch.recving)+len(packet.Bytes) { if wire.MaxBinaryReadSize < len(ch.recving)+len(packet.Bytes) {
return nil, wire.ErrBinaryReadSizeOverflow return nil, wire.ErrBinaryReadSizeOverflow
} }


+ 2
- 2
p2p/peer.go View File

@ -119,9 +119,9 @@ func (p *Peer) WriteTo(w io.Writer) (n int64, err error) {
func (p *Peer) String() string { func (p *Peer) String() string {
if p.outbound { if p.outbound {
return fmt.Sprintf("Peer{%v out}", p.Key)
return fmt.Sprintf("Peer{%v %v out}", p.mconn, p.Key[:12])
} else { } else {
return fmt.Sprintf("Peer{%v in}", p.Key)
return fmt.Sprintf("Peer{%v %v in}", p.mconn, p.Key[:12])
} }
} }


+ 1
- 1
scripts/unsafe_reset_net.sh View File

@ -3,7 +3,7 @@ set -euo pipefail
IFS=$'\n\t' IFS=$'\n\t'
debora run -- bash -c "cd \$GOPATH/src/github.com/tendermint/tendermint; killall tendermint; killall logjack" debora run -- bash -c "cd \$GOPATH/src/github.com/tendermint/tendermint; killall tendermint; killall logjack"
debora run -- bash -c "cd \$GOPATH/src/github.com/tendermint/tendermint; tendermint unsafe_reset_priv_validator; rm -rf ~/.tendermint/data; rm ~/.tendermint/genesis.json"
debora run -- bash -c "cd \$GOPATH/src/github.com/tendermint/tendermint; tendermint unsafe_reset_priv_validator; rm -rf ~/.tendermint/data; rm ~/.tendermint/genesis.json; rm ~/.tendermint/logs/*"
debora run -- bash -c "cd \$GOPATH/src/github.com/tendermint/tendermint; git pull origin develop; make" debora run -- bash -c "cd \$GOPATH/src/github.com/tendermint/tendermint; git pull origin develop; make"
debora run -- bash -c "cd \$GOPATH/src/github.com/tendermint/tendermint; mkdir -p ~/.tendermint/logs" debora run -- bash -c "cd \$GOPATH/src/github.com/tendermint/tendermint; mkdir -p ~/.tendermint/logs"
debora run --bg --label tendermint -- bash -c "cd \$GOPATH/src/github.com/tendermint/tendermint; tendermint node 2>&1 | stdinwriter -outpath ~/.tendermint/logs/tendermint.log" debora run --bg --label tendermint -- bash -c "cd \$GOPATH/src/github.com/tendermint/tendermint; tendermint node 2>&1 | stdinwriter -outpath ~/.tendermint/logs/tendermint.log"


Loading…
Cancel
Save