Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
algorand
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nilak
algorand
Commits
e7740e78
Commit
e7740e78
authored
Apr 09, 2019
by
THAKARE AKSHAY HARIBHAU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Network simulation is complete
parent
6201ad94
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
3 deletions
+10
-3
Link.py
Link.py
+1
-1
Network.py
Network.py
+2
-1
Node.py
Node.py
+7
-1
No files found.
Link.py
View file @
e7740e78
...
...
@@ -52,7 +52,7 @@ class Link(SystemEntity):
:return:
'''
self
.
messageQueue
.
append
(
message
)
print
(
"message enqued"
)
#
print("message enqued")
def
dequeMessage
(
self
):
return
self
.
messageQueue
.
pop
(
0
)
...
...
Network.py
View file @
e7740e78
...
...
@@ -2,6 +2,7 @@ from SystemEntity import SystemEntity
from
Link
import
Link
import
csv
from
Node
import
Node
from
OverlayNode
import
OverlayNode
import
logging
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -29,7 +30,7 @@ class Network():
reader
=
csv
.
reader
(
f
)
for
row
in
reader
:
node
=
row
[
0
]
# tuple of a link
self
.
nodes
.
update
({
node
:
Node
(
node
,
self
)})
self
.
nodes
.
update
({
node
:
Overlay
Node
(
node
,
self
)})
# print(self.nodes.get('1')) #keys are strings
...
...
Node.py
View file @
e7740e78
...
...
@@ -24,7 +24,7 @@ class Node(SystemEntity):
:return:
'''
self
.
messageQueue
.
append
(
message
)
print
(
"message enqued"
)
#
print("message enqued")
def
dequeMessage
(
self
):
return
self
.
messageQueue
.
pop
(
0
)
...
...
@@ -42,6 +42,12 @@ class Node(SystemEntity):
self
.
logger
.
info
(
"Sending : "
+
str
((
time
,
params
)))
pass
def
broadcast
(
self
,
time
,
gossipPayload
):
for
node
in
self
.
adjacentNodes
:
link
=
self
.
network
.
links
.
get
((
self
.
id
,
node
.
id
))
link
.
enqueMessage
((
time
,
(
self
.
id
,
node
.
id
,
gossipPayload
)))
self
.
logger
.
info
(
"Sending : "
+
str
((
time
,
(
self
.
id
,
node
.
id
,
gossipPayload
))))
def
processMessage
(
self
,
time
,
payload
):
print
(
"fianlly reached : "
+
str
(
payload
))
'''remove any extra headers like source and destination here '''
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment