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}"
--identity "${name}"
--ens-api "${GETH_RPC_URL}"
--httpaddr "${ip}"
--bzznetworkid "321"
--bzzaccount "${address}"
--password "${dir}/password"
--verbosity "6"
--debug
)
start_node "${name}" "${ip}" "$(which swarm)" ${args[@]}

View file

@ -214,7 +214,7 @@ func newSyncer(
*/
if state.SessionAt == 0 {
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()))
for p := priorities - 1; p >= 0; p-- {
@ -369,7 +369,7 @@ func (self *syncer) sendUnsyncedKeys() {
func (self *syncer) syncUnsyncedKeys() {
// send out new
var unsynced []*syncRequest
var more, justSynced bool
var more bool
var keyCount, historyCnt int
priority := High
@ -426,9 +426,8 @@ LOOP:
// * batch full OR
// * all history have been consumed, synced)
if deliveryRequest == nil &&
(justSynced && len(unsynced) > 0 ||
(keys == nil && len(unsynced) > 0 ||
len(unsynced) == int(self.SyncBatchSize)) {
justSynced = false
// listen to requests
deliveryRequest = self.deliveryRequest
newUnsyncedKeys = nil // not care about data until next req comes in
@ -455,7 +454,6 @@ LOOP:
if keys == history && !more {
log.Trace(fmt.Sprintf("syncer[%v]: syncing history segment complete", self.key.Log()))
// 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))