aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/swarm.go
diff options
context:
space:
mode:
authorholisticode <holistic.computing@gmail.com>2018-11-07 07:04:18 +0800
committerViktor TrĂ³n <viktor.tron@gmail.com>2018-11-07 07:04:18 +0800
commit79c7a69ac8066cc28ceee2ebaab3d0221a8adf57 (patch)
treeafbba15675b0b8a8153523bb661499673d4e43da /swarm/swarm.go
parent53eb4e0b0fffdc105fbe9f5eed671b96de6e2ba1 (diff)
downloaddexon-79c7a69ac8066cc28ceee2ebaab3d0221a8adf57.tar
dexon-79c7a69ac8066cc28ceee2ebaab3d0221a8adf57.tar.gz
dexon-79c7a69ac8066cc28ceee2ebaab3d0221a8adf57.tar.bz2
dexon-79c7a69ac8066cc28ceee2ebaab3d0221a8adf57.tar.lz
dexon-79c7a69ac8066cc28ceee2ebaab3d0221a8adf57.tar.xz
dexon-79c7a69ac8066cc28ceee2ebaab3d0221a8adf57.tar.zst
dexon-79c7a69ac8066cc28ceee2ebaab3d0221a8adf57.zip
swarm: Better syncing and retrieval option definition (#17986)
* swarm: Better syncing and retrieval option definition * swarm/network/stream: better comments * swarm/network/stream: addressed PR comments
Diffstat (limited to 'swarm/swarm.go')
-rw-r--r--swarm/swarm.go20
1 files changed, 13 insertions, 7 deletions
diff --git a/swarm/swarm.go b/swarm/swarm.go
index 7214abbda..1fb5443fd 100644
--- a/swarm/swarm.go
+++ b/swarm/swarm.go
@@ -175,18 +175,24 @@ func NewSwarm(config *api.Config, mockStore *mock.NodeStore) (self *Swarm, err e
if err := nodeID.UnmarshalText([]byte(config.NodeID)); err != nil {
return nil, err
}
+
+ syncing := stream.SyncingAutoSubscribe
+ if !config.SyncEnabled || config.LightNodeEnabled {
+ syncing = stream.SyncingDisabled
+ }
+
+ retrieval := stream.RetrievalEnabled
+ if config.LightNodeEnabled {
+ retrieval = stream.RetrievalClientOnly
+ }
+
registryOptions := &stream.RegistryOptions{
SkipCheck: config.DeliverySkipCheck,
- DoSync: config.SyncEnabled,
- DoRetrieve: true,
- DoServeRetrieve: true,
+ Syncing: syncing,
+ Retrieval: retrieval,
SyncUpdateDelay: config.SyncUpdateDelay,
MaxPeerServers: config.MaxStreamPeerServers,
}
- if config.LightNodeEnabled {
- registryOptions.DoSync = false
- registryOptions.DoRetrieve = false
- }
self.streamer = stream.NewRegistry(nodeID, delivery, self.netStore, stateStore, registryOptions)
// Swarm Hash Merklised Chunking for Arbitrary-length Document/File storage