Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various network topology examples. #41

Merged
merged 39 commits into from
Jul 1, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5dd1f7a
Ring topology test
doug-perlin Jun 26, 2018
7048073
topology-ring: finish ring test
doug-perlin Jun 26, 2018
ba56843
Setup all the topologies
doug-perlin Jun 27, 2018
db9023a
topology-ring: clean up some code
doug-perlin Jun 27, 2018
7fae6ea
Added tests for all the nodes
doug-perlin Jun 27, 2018
f89a3ba
topology-ring: added sending messages from all the nodes
doug-perlin Jun 27, 2018
bf7137d
Merge branch 'master' into topology-ring
doug-perlin Jun 27, 2018
45f6fda
Fix up the topology tests to work with master
doug-perlin Jun 27, 2018
204bf63
Merge branch 'fix-tests' into topology-ring
doug-perlin Jun 27, 2018
fe9118e
Allow the mesh topology test to run
doug-perlin Jun 27, 2018
abb643e
Merge branch 'master' into topology-ring
doug-perlin Jun 28, 2018
0bdeb61
merged master, seems to be broken now
doug-perlin Jun 28, 2018
c44e2f0
Try to debug ring test
doug-perlin Jun 28, 2018
5a3c199
Merge branch 'master' into topology-ring
doug-perlin Jun 28, 2018
911d85f
More sleeps
doug-perlin Jun 28, 2018
91ea44a
net: Created function BlockUntilListening() to block functions until …
iwasaki-kenta Jun 28, 2018
05dff08
remove debug statements
doug-perlin Jun 28, 2018
91834e2
Merge branch 'topology-ring' of github.com:perlin-network/noise into …
doug-perlin Jun 28, 2018
0736304
Fix compile error
doug-perlin Jun 28, 2018
76cbaf5
Fixed the ring test
doug-perlin Jun 28, 2018
2e74e95
Cleaned up the tests
doug-perlin Jun 28, 2018
b299f1f
Made some of the offset more clear, removed the t.Parallel()
doug-perlin Jun 28, 2018
dc57af8
Reduce the timeouts
doug-perlin Jun 28, 2018
ef8677c
Fix some typos
doug-perlin Jun 28, 2018
eed7932
Reduce the timeout
doug-perlin Jun 28, 2018
eb7f97b
Merge branch 'master' into topology-ring
doug-perlin Jun 29, 2018
1e376ea
topology: all pass except for ring
doug-perlin Jun 29, 2018
3252b04
top: Fix the ring test
doug-perlin Jun 29, 2018
10eb1a3
top: Cleaned up comments, parallelize the tests, disabled peer discovery
doug-perlin Jun 29, 2018
9e7f71f
top: Updated some comments
doug-perlin Jun 29, 2018
b8c353a
top: fix up comment
doug-perlin Jun 29, 2018
d808f9d
top: Converted the test to an example
doug-perlin Jun 29, 2018
ee474fb
Merge branch 'master' into topology-ring
doug-perlin Jul 1, 2018
c66b263
Merge branch 'master' into topology-ring
doug-perlin Jul 1, 2018
dc72e4d
Fixed up the merge to master
doug-perlin Jul 1, 2018
2d32fa3
top: Made starting port greater to make it less likely to conflict.
iwasaki-kenta Jul 1, 2018
ae5163a
topology: Converted the example to a test, added short flags to skip
doug-perlin Jul 1, 2018
8e8ac52
Merge branch 'topology-ring' of github.com:perlin-network/noise into …
doug-perlin Jul 1, 2018
0600b5a
Merge branch 'master' into topology-ring
doug-perlin Jul 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix up the topology tests to work with master
  • Loading branch information
doug-perlin committed Jun 27, 2018
commit 45f6fda140433639808ae3d62c189dc203e00b99
2 changes: 2 additions & 0 deletions examples/basic/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ func SetupCluster(nodes []ClusterNode) error {
node.SetNet(net)

go net.Listen()

<-net.Listening
}

return nil
Expand Down
10 changes: 4 additions & 6 deletions examples/topologies/topo_node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ func (e *TopoNode) Host() string {
return e.h
}

func (e *TopoNode) Port() int {
return e.p
func (e *TopoNode) Port() uint16 {
return uint16(e.p)
}

func (e *TopoNode) Peers() []string {
Expand All @@ -36,11 +36,9 @@ func (e *TopoNode) SetNet(n *network.Network) {
}

// Handle implements the network interface callback
func (e *TopoNode) Handle(client *network.PeerClient, raw *network.IncomingMessage) error {
message := raw.Message.(*messages.BasicMessage)

func (e *TopoNode) Handle(ctx *network.MessageContext) error {
message := ctx.Message().(*messages.BasicMessage)
e.Messages = append(e.Messages, message)

return nil
}

Expand Down
6 changes: 3 additions & 3 deletions examples/topologies/topologies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,14 @@ func broadcastNode(t *testing.T, nodes []*TopoNode, sendingNodeIdx int) {
} else {
// this is a receiving node, it should have just the one message buffered up
if result := nodes[i].PopMessage(); result == nil {
t.Errorf("expected a message in (sending node %d) receiving node %d but it was blank", sendingNodeIdx, i)
t.Errorf("expected a message for node %d --> %d, but it was blank", sendingNodeIdx, i)
} else {
if result.Message != testMessage {
t.Errorf("expected message %s in (sending node %d) receiving node %d but got %v", testMessage, sendingNodeIdx, i, result)
t.Errorf("expected message %s for node %d --> %d, but got %v", testMessage, sendingNodeIdx, i, result)
}
}
if len(nodes[i].Messages) > 0 {
t.Errorf("expected no messages buffered in (sending node %d) receiving node %d, found: %v", sendingNodeIdx, i, nodes[i].Messages)
t.Errorf("expected no messages for node %d --> %d, but found: %v", sendingNodeIdx, i, nodes[i].Messages)
}
}
}
Expand Down