aboutsummaryrefslogtreecommitdiff
path: root/test_msgnet/main.go
diff options
context:
space:
mode:
authorDeterminant <tederminant@gmail.com>2019-06-11 19:28:12 -0400
committerDeterminant <tederminant@gmail.com>2019-06-11 19:28:12 -0400
commit1371ede9aad86dce624f4486b5d7831aa6de5a70 (patch)
treef04b9f7afddde9a03b71734e2bbce7b9fcabad12 /test_msgnet/main.go
parent69d0435bcc88cc8b4c140b876df5fcfb827b40ef (diff)
finish the stress test
Diffstat (limited to 'test_msgnet/main.go')
-rw-r--r--test_msgnet/main.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/test_msgnet/main.go b/test_msgnet/main.go
index 230bd83..1ebdc74 100644
--- a/test_msgnet/main.go
+++ b/test_msgnet/main.go
@@ -38,13 +38,13 @@ func msgHelloSerialize(name string, text string) salticidae.Msg {
serialized.PutData(t)
serialized.PutData([]byte(name))
serialized.PutData([]byte(text))
- return salticidae.NewMsg(
+ return salticidae.NewMsgMovedFromByteArray(
MSG_OPCODE_HELLO,
salticidae.NewByteArrayMovedFromDataStream(serialized))
}
func msgHelloUnserialize(msg salticidae.Msg) MsgHello {
- p := msg.GetPayload()
+ p := msg.ConsumePayload()
length := binary.LittleEndian.Uint32(p.GetDataInPlace(4))
name := string(p.GetDataInPlace(int(length)))
text := string(p.GetDataInPlace(p.Size()))
@@ -53,7 +53,7 @@ func msgHelloUnserialize(msg salticidae.Msg) MsgHello {
}
func msgAckSerialize() salticidae.Msg {
- return salticidae.NewMsg(MSG_OPCODE_ACK, salticidae.NewByteArray())
+ return salticidae.NewMsgMovedFromByteArray(MSG_OPCODE_ACK, salticidae.NewByteArray())
}
type MyNet struct {