diff options
author | Determinant <[email protected]> | 2019-06-30 18:35:20 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-06-30 18:35:20 -0400 |
commit | bbe214128b6f7cb4e57fcda7adc3205ec9ec66cb (patch) | |
tree | 67563de5f0ab2bd9cef29e5ed7efb25398f6219c /test_msgnet_tls | |
parent | d247c437f396709f62eadaf863b8a552d7142fc7 (diff) |
allow manual memory management for types frequently used in messaging
Diffstat (limited to 'test_msgnet_tls')
-rw-r--r-- | test_msgnet_tls/main.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test_msgnet_tls/main.go b/test_msgnet_tls/main.go index 1d613fd..78601a2 100644 --- a/test_msgnet_tls/main.go +++ b/test_msgnet_tls/main.go @@ -23,12 +23,12 @@ const ( ) func msgHelloSerialize(name string, text string) salticidae.Msg { - serialized := salticidae.NewDataStream() + serialized := salticidae.NewDataStream(true) serialized.PutU32(salticidae.ToLittleEndianU32(uint32(len(name)))) serialized.PutData([]byte(name)) serialized.PutData([]byte(text)) return salticidae.NewMsgMovedFromByteArray( - MSG_OPCODE_HELLO, salticidae.NewByteArrayMovedFromDataStream(serialized)) + MSG_OPCODE_HELLO, salticidae.NewByteArrayMovedFromDataStream(serialized, true), true) } func msgHelloUnserialize(msg salticidae.Msg) (name string, text string) { @@ -41,7 +41,7 @@ func msgHelloUnserialize(msg salticidae.Msg) (name string, text string) { } func msgAckSerialize() salticidae.Msg { - return salticidae.NewMsgMovedFromByteArray(MSG_OPCODE_ACK, salticidae.NewByteArray()) + return salticidae.NewMsgMovedFromByteArray(MSG_OPCODE_ACK, salticidae.NewByteArray(true), true) } func checkError(err *salticidae.Error) { @@ -95,7 +95,7 @@ func connHandler(_conn *C.struct_msgnetwork_conn_t, connected C.bool, userdata u if myName == "bob" { n = bob } res := true if connected { - certHash := conn.GetPeerCert().GetDer().GetHash() + certHash := conn.GetPeerCert().GetDer(true).GetHash(true) res = certHash.IsEq(n.peerCert) if conn.GetMode() == salticidae.CONN_MODE_ACTIVE { fmt.Printf("[%s] connected, sending hello.\n", myName) |