mirror of https://github.com/vacp2p/research.git
Dont print sync state
This commit is contained in:
parent
e553dd67d1
commit
c9c317095a
|
@ -1,5 +1,8 @@
|
||||||
import networkwhisper, sync, sys, threading, time
|
import networkwhisper, sync, sys, threading, time
|
||||||
|
|
||||||
|
# TODO: Consider moving sync state outside of log
|
||||||
|
# XXX: Assume {a,b}sync.log exists
|
||||||
|
|
||||||
# XXX: Ugly constants, should be elsewhere
|
# XXX: Ugly constants, should be elsewhere
|
||||||
SETTINGS = {
|
SETTINGS = {
|
||||||
'a': {
|
'a': {
|
||||||
|
@ -82,7 +85,8 @@ def main():
|
||||||
rec = sync.new_message_record(text)
|
rec = sync.new_message_record(text)
|
||||||
node.append_message(rec)
|
node.append_message(rec)
|
||||||
|
|
||||||
node.print_sync_state()
|
# XXX: Dunno best way to showcase this
|
||||||
|
#node.print_sync_state()
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
|
|
@ -362,8 +362,8 @@ class Node():
|
||||||
self.sync_state[req][sender_pubkey]["request_flag"] = 1
|
self.sync_state[req][sender_pubkey]["request_flag"] = 1
|
||||||
|
|
||||||
def print_sync_state(self):
|
def print_sync_state(self):
|
||||||
self.logger("\n{} POV @{}".format(self.name[-4:], self.time))
|
print("\n{} POV @{}".format(self.name[-4:], self.time))
|
||||||
self.logger("-" * 60)
|
print("-" * 60)
|
||||||
n = self.name
|
n = self.name
|
||||||
for message_id, x in self.sync_state.items():
|
for message_id, x in self.sync_state.items():
|
||||||
line = message_id[-4:] + " | "
|
line = message_id[-4:] + " | "
|
||||||
|
@ -379,13 +379,13 @@ class Node():
|
||||||
line += "(" + str(flags['send_count']) + ")"
|
line += "(" + str(flags['send_count']) + ")"
|
||||||
line += " | "
|
line += " | "
|
||||||
|
|
||||||
self.logger(line)
|
print(line)
|
||||||
#log("-" * 60)
|
#log("-" * 60)
|
||||||
|
|
||||||
# Shorter names for pubkey
|
# Shorter names for pubkey
|
||||||
def print_sync_state2(self):
|
def print_sync_state2(self):
|
||||||
self.logger("\n{} POV @{}".format(self.name[-4:], self.time))
|
print("\n{} POV @{}".format(self.name[-4:], self.time))
|
||||||
self.logger("-" * 60)
|
print("-" * 60)
|
||||||
n = self.name[-4:]
|
n = self.name[-4:]
|
||||||
for message_id, x in self.sync_state.items():
|
for message_id, x in self.sync_state.items():
|
||||||
line = message_id[-4:] + " | "
|
line = message_id[-4:] + " | "
|
||||||
|
@ -401,7 +401,7 @@ class Node():
|
||||||
line += "(" + str(flags['send_count']) + ")"
|
line += "(" + str(flags['send_count']) + ")"
|
||||||
line += " | "
|
line += " | "
|
||||||
|
|
||||||
self.logger(line)
|
print(line)
|
||||||
#log("-" * 60)
|
#log("-" * 60)
|
||||||
|
|
||||||
def update_availability(self):
|
def update_availability(self):
|
||||||
|
@ -551,10 +551,10 @@ def run(steps=10):
|
||||||
#b.print_sync_state()
|
#b.print_sync_state()
|
||||||
#c.print_sync_state()
|
#c.print_sync_state()
|
||||||
|
|
||||||
a.print_sync_state()
|
# a.print_sync_state()
|
||||||
b.print_sync_state()
|
# b.print_sync_state()
|
||||||
c.print_sync_state()
|
# c.print_sync_state()
|
||||||
d.print_sync_state()
|
# d.print_sync_state()
|
||||||
|
|
||||||
def whisperRun(steps=10):
|
def whisperRun(steps=10):
|
||||||
a_keyPair = "0x57083392b29bdf24512c93cfdf45d38c87d9d882da3918c59f4406445ea976a4"
|
a_keyPair = "0x57083392b29bdf24512c93cfdf45d38c87d9d882da3918c59f4406445ea976a4"
|
||||||
|
@ -610,8 +610,8 @@ def whisperRun(steps=10):
|
||||||
#a.print_sync_state()
|
#a.print_sync_state()
|
||||||
#b.print_sync_state()
|
#b.print_sync_state()
|
||||||
|
|
||||||
a.print_sync_state2()
|
# a.print_sync_state2()
|
||||||
b.print_sync_state2()
|
# b.print_sync_state2()
|
||||||
|
|
||||||
# TODO: With Whisper branch this one breaks, probably due to sender{,.name} => sender_pubkey mismatch.
|
# TODO: With Whisper branch this one breaks, probably due to sender{,.name} => sender_pubkey mismatch.
|
||||||
#run(30)
|
#run(30)
|
||||||
|
|
Loading…
Reference in New Issue