From 9af95694330d8d0a56f534509e98dbac8e89e85e Mon Sep 17 00:00:00 2001 From: Determinant Date: Fri, 7 Jun 2019 22:36:19 -0400 Subject: ... --- test_msgnet/main.go | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'test_msgnet') diff --git a/test_msgnet/main.go b/test_msgnet/main.go index a92556f..b768adf 100644 --- a/test_msgnet/main.go +++ b/test_msgnet/main.go @@ -9,7 +9,6 @@ package main import "C" import ( - "unsafe" "encoding/binary" "fmt" "salticidae-go" @@ -130,13 +129,13 @@ func main() { alice = genMyNet(ec, "Alice") bob = genMyNet(ec, "Bob") - alice.net.RegHandler(MSG_OPCODE_HELLO, salticidae.MsgNetworkMsgCallback(unsafe.Pointer(C.onReceiveHello))) - alice.net.RegHandler(MSG_OPCODE_ACK, salticidae.MsgNetworkMsgCallback(unsafe.Pointer(C.onReceiveAck))) - alice.net.RegConnHandler(salticidae.MsgNetworkConnCallback(unsafe.Pointer(C.connHandler))) + alice.net.RegHandler(MSG_OPCODE_HELLO, salticidae.MsgNetworkMsgCallback(C.onReceiveHello)) + alice.net.RegHandler(MSG_OPCODE_ACK, salticidae.MsgNetworkMsgCallback(C.onReceiveAck)) + alice.net.RegConnHandler(salticidae.MsgNetworkConnCallback(C.connHandler)) - bob.net.RegHandler(MSG_OPCODE_HELLO, salticidae.MsgNetworkMsgCallback(unsafe.Pointer(C.onReceiveHello))) - bob.net.RegHandler(MSG_OPCODE_ACK, salticidae.MsgNetworkMsgCallback(unsafe.Pointer(C.onReceiveAck))) - bob.net.RegConnHandler(salticidae.MsgNetworkConnCallback(unsafe.Pointer(C.connHandler))) + bob.net.RegHandler(MSG_OPCODE_HELLO, salticidae.MsgNetworkMsgCallback(C.onReceiveHello)) + bob.net.RegHandler(MSG_OPCODE_ACK, salticidae.MsgNetworkMsgCallback(C.onReceiveAck)) + bob.net.RegConnHandler(salticidae.MsgNetworkConnCallback(C.connHandler)) alice.net.Start() bob.net.Start() @@ -150,9 +149,9 @@ func main() { alice_addr.Free() bob_addr.Free() - ev_int := salticidae.NewSigEvent(ec, salticidae.SigEventCallback(unsafe.Pointer(C.onTerm))) + ev_int := salticidae.NewSigEvent(ec, salticidae.SigEventCallback(C.onTerm)) ev_int.Add(salticidae.SIGINT) - ev_term := salticidae.NewSigEvent(ec, salticidae.SigEventCallback(unsafe.Pointer(C.onTerm))) + ev_term := salticidae.NewSigEvent(ec, salticidae.SigEventCallback(C.onTerm)) ev_term.Add(salticidae.SIGTERM) ec.Dispatch() -- cgit v1.2.3-70-g09d2