aboutsummaryrefslogtreecommitdiff
path: root/test_msgnet
diff options
context:
space:
mode:
Diffstat (limited to 'test_msgnet')
-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 {