Skip to content

Commit

Permalink
Renamed NewMessageOut to Message
Browse files Browse the repository at this point in the history
  • Loading branch information
oxtoacart committed Nov 29, 2014
1 parent 41dc1c2 commit d743998
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ type MessageIn struct {
Body []byte
}

// NewMessage builds a new message to the given peer with the given body.
func NewMessageOut(to PeerId, body ...[]byte) *MessageOut {
// Message builds a new message to the given peer with the given body.
func Message(to PeerId, body ...[]byte) *MessageOut {
return &MessageOut{to, body}
}

Expand Down
6 changes: 3 additions & 3 deletions waddell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func doTestPeers(t *testing.T, useTLS bool) {
if err != nil {
log.Fatalf("Unable to get peer id: %s", err)
}
badPeer.Out(TestTopic) <- NewMessageOut(badPeerId, ld)
badPeer.Out(TestTopic) <- Message(badPeerId, ld)
}

// Simulate readers and writers
Expand All @@ -294,7 +294,7 @@ func doTestPeers(t *testing.T, useTLS bool) {
// Write to each reader
for j := 0; j < NumPeers; j += 2 {
recip := peers[j]
peer.client.Out(TestTopic) <- NewMessageOut(recip.id, []byte(Hello[:2]), []byte(Hello[2:]))
peer.client.Out(TestTopic) <- Message(recip.id, []byte(Hello[:2]), []byte(Hello[2:]))
if err != nil {
log.Fatalf("Unable to write hello: %s", err)
} else {
Expand All @@ -317,7 +317,7 @@ func doTestPeers(t *testing.T, useTLS bool) {
}
msg := <-peer.client.In(TestTopic)
assert.Equal(t, Hello, string(msg.Body), "Hello message should match expected")
peer.client.Out(TestTopic) <- NewMessageOut(msg.From, []byte(fmt.Sprintf(HelloYourself, msg.From)))
peer.client.Out(TestTopic) <- Message(msg.From, []byte(fmt.Sprintf(HelloYourself, msg.From)))
if err != nil {
log.Fatalf("Unable to write response to HELLO message: %s", err)
}
Expand Down

0 comments on commit d743998

Please sign in to comment.