swarm/network;swarm/dev:fix new syncer bugs

This commit is contained in:
Zahoor Mohamed 2017-07-11 17:58:25 +05:30
parent 73cc315638
commit 163cef750e
No known key found for this signature in database
GPG key ID: 2AA8DAE9EF41AC07
2 changed files with 5 additions and 5 deletions

View file

@ -209,10 +209,12 @@ start_swarm_node() {
--datadir "${dir}" --datadir "${dir}"
--identity "${name}" --identity "${name}"
--ens-api "${GETH_RPC_URL}" --ens-api "${GETH_RPC_URL}"
--httpaddr "${ip}"
--bzznetworkid "321" --bzznetworkid "321"
--bzzaccount "${address}" --bzzaccount "${address}"
--password "${dir}/password" --password "${dir}/password"
--verbosity "6" --verbosity "6"
--debug
) )
start_node "${name}" "${ip}" "$(which swarm)" ${args[@]} start_node "${name}" "${ip}" "$(which swarm)" ${args[@]}

View file

@ -214,7 +214,7 @@ func newSyncer(
*/ */
if state.SessionAt == 0 { if state.SessionAt == 0 {
log.Trace(fmt.Sprintf("syncer[%v]: nothing to sync", self.key.Log())) log.Trace(fmt.Sprintf("syncer[%v]: nothing to sync", self.key.Log()))
return self, nil // return self, nil
} }
log.Trace(fmt.Sprintf("syncer[%v]: start replaying stale requests from request db", self.key.Log())) log.Trace(fmt.Sprintf("syncer[%v]: start replaying stale requests from request db", self.key.Log()))
for p := priorities - 1; p >= 0; p-- { for p := priorities - 1; p >= 0; p-- {
@ -369,7 +369,7 @@ func (self *syncer) sendUnsyncedKeys() {
func (self *syncer) syncUnsyncedKeys() { func (self *syncer) syncUnsyncedKeys() {
// send out new // send out new
var unsynced []*syncRequest var unsynced []*syncRequest
var more, justSynced bool var more bool
var keyCount, historyCnt int var keyCount, historyCnt int
priority := High priority := High
@ -426,9 +426,8 @@ LOOP:
// * batch full OR // * batch full OR
// * all history have been consumed, synced) // * all history have been consumed, synced)
if deliveryRequest == nil && if deliveryRequest == nil &&
(justSynced && len(unsynced) > 0 || (keys == nil && len(unsynced) > 0 ||
len(unsynced) == int(self.SyncBatchSize)) { len(unsynced) == int(self.SyncBatchSize)) {
justSynced = false
// listen to requests // listen to requests
deliveryRequest = self.deliveryRequest deliveryRequest = self.deliveryRequest
newUnsyncedKeys = nil // not care about data until next req comes in newUnsyncedKeys = nil // not care about data until next req comes in
@ -455,7 +454,6 @@ LOOP:
if keys == history && !more { if keys == history && !more {
log.Trace(fmt.Sprintf("syncer[%v]: syncing history segment complete", self.key.Log())) log.Trace(fmt.Sprintf("syncer[%v]: syncing history segment complete", self.key.Log()))
// moved to closing of channel in syncHistory // moved to closing of channel in syncHistory
justSynced = true
log.Trace(fmt.Sprintf("syncer[%v]: start synchronising history since last disconnect at %v up until session start at %v: %v", self.key.Log(), state.Last, state.SessionAt, state)) log.Trace(fmt.Sprintf("syncer[%v]: start synchronising history since last disconnect at %v up until session start at %v: %v", self.key.Log(), state.Last, state.SessionAt, state))