swarm/network: bump bzz protocol version

This commit is contained in:
Anton Evangelatov 2019-05-16 15:20:57 +02:00
parent 71bd6f7d10
commit c9bbec4974
3 changed files with 9 additions and 8 deletions

View file

@ -43,7 +43,7 @@ var DefaultTestNetworkID = rand.Uint64()
// BzzSpec is the spec of the generic swarm handshake // BzzSpec is the spec of the generic swarm handshake
var BzzSpec = &protocols.Spec{ var BzzSpec = &protocols.Spec{
Name: "bzz", Name: "bzz",
Version: 8, Version: 9,
MaxMsgSize: 10 * 1024 * 1024, MaxMsgSize: 10 * 1024 * 1024,
Messages: []interface{}{ Messages: []interface{}{
HandshakeMsg{}, HandshakeMsg{},

View file

@ -36,7 +36,7 @@ import (
) )
const ( const (
TestProtocolVersion = 8 TestProtocolVersion = 9
) )
var TestProtocolNetworkID = DefaultTestNetworkID var TestProtocolNetworkID = DefaultTestNetworkID

View file

@ -18,6 +18,7 @@ package stream
import ( import (
"context" "context"
"fmt"
"strconv" "strconv"
"time" "time"
@ -58,7 +59,7 @@ func RegisterSwarmSyncerServer(streamer *Registry, netStore *storage.NetStore) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
return NewSwarmSyncerServer(po, netStore, p.ID().String()+"|"+string(po)) return NewSwarmSyncerServer(po, netStore, fmt.Sprintf("%s|%d", p.ID(), po))
}) })
// streamer.RegisterServerFunc(stream, func(p *Peer) (Server, error) { // streamer.RegisterServerFunc(stream, func(p *Peer) (Server, error) {
// return NewOutgoingProvableSwarmSyncer(po, db) // return NewOutgoingProvableSwarmSyncer(po, db)
@ -146,16 +147,16 @@ func (s *SwarmSyncerServer) SetNextBatch(from, to uint64) ([]byte, uint64, uint6
if batchSize >= BatchSize { if batchSize >= BatchSize {
iterate = false iterate = false
metrics.GetOrRegisterCounter("syncer.set-next-batch.full-batch", nil).Inc(1) metrics.GetOrRegisterCounter("syncer.set-next-batch.full-batch", nil).Inc(1)
log.Debug("syncer pull subscription - batch size reached", "correlateId", s.correlateId, "batchSize", batchSize, "batchStartID", batchStartID, "batchEndID", batchEndID) log.Trace("syncer pull subscription - batch size reached", "correlateId", s.correlateId, "batchSize", batchSize, "batchStartID", batchStartID, "batchEndID", batchEndID)
} }
if timer == nil { if timer == nil {
timer = time.NewTimer(batchTimeout) timer = time.NewTimer(batchTimeout)
} else { } else {
log.Debug("syncer pull subscription - stopping timer", "correlateId", s.correlateId) log.Trace("syncer pull subscription - stopping timer", "correlateId", s.correlateId)
if !timer.Stop() { if !timer.Stop() {
<-timer.C <-timer.C
} }
log.Debug("syncer pull subscription - channel drained, resetting timer", "correlateId", s.correlateId) log.Trace("syncer pull subscription - channel drained, resetting timer", "correlateId", s.correlateId)
timer.Reset(batchTimeout) timer.Reset(batchTimeout)
} }
timerC = timer.C timerC = timer.C
@ -164,10 +165,10 @@ func (s *SwarmSyncerServer) SetNextBatch(from, to uint64) ([]byte, uint64, uint6
// received after some time // received after some time
iterate = false iterate = false
metrics.GetOrRegisterCounter("syncer.set-next-batch.timer-expire", nil).Inc(1) metrics.GetOrRegisterCounter("syncer.set-next-batch.timer-expire", nil).Inc(1)
log.Debug("syncer pull subscription timer expired", "correlateId", s.correlateId, "batchSize", batchSize, "batchStartID", batchStartID, "batchEndID", batchEndID) log.Trace("syncer pull subscription timer expired", "correlateId", s.correlateId, "batchSize", batchSize, "batchStartID", batchStartID, "batchEndID", batchEndID)
case <-s.quit: case <-s.quit:
iterate = false iterate = false
log.Debug("syncer pull subscription - quit received", "correlateId", s.correlateId, "batchSize", batchSize, "batchStartID", batchStartID, "batchEndID", batchEndID) log.Trace("syncer pull subscription - quit received", "correlateId", s.correlateId, "batchSize", batchSize, "batchStartID", batchStartID, "batchEndID", batchEndID)
} }
} }
if batchStartID == nil { if batchStartID == nil {