mirror of https://github.com/vacp2p/research.git
Fix sync node bug - it acks now!
This commit is contained in:
parent
ff4dddb71b
commit
9bf2a4feec
|
@ -78,6 +78,7 @@ for (var p=0; p < admin.peers.length; p++) { console.log(admin.peers[p].enode);
|
|||
|
||||
admin.addPeer("enode://531e252ec966b7e83f5538c19bf1cde7381cc7949026a6e499b6e998e695751aadf26d4c98d5a4eabfb7cefd31c3c88d600a775f14ed5781520a88ecd25da3c6@35.225.227.79:30504")
|
||||
|
||||
|
||||
ok, so this works.
|
||||
|
||||
Problem: even with detailed logs very little feedback
|
||||
|
|
|
@ -21,7 +21,8 @@ def tick_process(node, whisper_node):
|
|||
#print("tick")
|
||||
# XXX: careful maybe
|
||||
whisper_node.tick()
|
||||
node.tick()
|
||||
# This should be done in the sync
|
||||
#node.tick()
|
||||
time.sleep(0.1)
|
||||
|
||||
def main():
|
||||
|
@ -36,7 +37,8 @@ def main():
|
|||
|
||||
# Init node
|
||||
whisper_node = networkwhisper.WhisperNodeHelper(keypair, host)
|
||||
node = sync.Node(identity_pk, whisper_node, 'onlineDesktop', 'interactive')
|
||||
# XXX: interactive mode with offer might not work?
|
||||
node = sync.Node(identity_pk, whisper_node, 'onlineDesktop', 'batch')
|
||||
|
||||
#where?
|
||||
#whisper_node.tick()
|
||||
|
|
|
@ -21,8 +21,12 @@ class WhisperNodeHelper():
|
|||
self.kId = self.web3.shh.addPrivateKey(self.keyPair)
|
||||
self.myFilter = self.poll_filter(self.topic, self.keyPair)
|
||||
|
||||
# XXX: Race, since before this is set it isn't ready to receive
|
||||
# Later sync node - setup in Node init fn
|
||||
self.sync_node = None
|
||||
|
||||
# XXX: Prune this
|
||||
self.nodes = []
|
||||
#self.nodes = []
|
||||
self.time = 0
|
||||
#self.queue = {}
|
||||
#self.peers = {}
|
||||
|
@ -70,7 +74,11 @@ class WhisperNodeHelper():
|
|||
print("\nRECV parse", msg.payload.message.body.decode())
|
||||
|
||||
# XXX Only one receiver, this is a node not network
|
||||
receiver = self.nodes[0]
|
||||
# XXX: Not populating? Why do we need this anyway?
|
||||
# Well this is the sync node, so how self? node
|
||||
# IF I recv something it is myself!
|
||||
#receiver = self.nodes[0]
|
||||
receiver = self.sync_node
|
||||
# HEREATM
|
||||
# How sender?
|
||||
# TODO: Figure out how we know sender, assumes signed message
|
||||
|
@ -87,9 +95,8 @@ class WhisperNodeHelper():
|
|||
#print "-----------"
|
||||
|
||||
# XXX: This is ugly, why is this ticking nodes?
|
||||
# NOTE: Only self is ticking
|
||||
for n in self.nodes:
|
||||
n.tick()
|
||||
# Also then don't tick
|
||||
self.sync_node.tick()
|
||||
self.time += 1
|
||||
|
||||
# NetworkSim stub
|
||||
|
@ -115,10 +122,10 @@ class WhisperNodeHelper():
|
|||
# ok it sends, but not being picked up
|
||||
# static-nodes same?
|
||||
def send_message(self, sender_id, address_to, msg):
|
||||
print("*** (whisper-network) send_message to", address_to)
|
||||
#print("*** (whisper-network) send_message to", address_to)
|
||||
# XXX: Is this what we want to do?
|
||||
payload = msg.SerializeToString()
|
||||
print("*** (whisper-network) send_message payload", payload)
|
||||
#print("*** (whisper-network) send_message payload", payload)
|
||||
#print("*** (whisper-network) send_message hex", self.web3.toHex(payload))
|
||||
topic = self.topic
|
||||
self.web3.shh.post({
|
||||
|
|
|
@ -39,6 +39,10 @@ class Node():
|
|||
self.group_id = GROUP_ID
|
||||
self.sharing = {GROUP_ID: set()}
|
||||
|
||||
|
||||
# Network should be aware of sync node so it can call it
|
||||
network.sync_node = self
|
||||
|
||||
self.profile = profile
|
||||
# for index in pulsating reseries if mobile node
|
||||
|
||||
|
|
Loading…
Reference in New Issue