diff options
author | Determinant <[email protected]> | 2019-06-07 22:36:19 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-06-07 22:36:19 -0400 |
commit | 9af95694330d8d0a56f534509e98dbac8e89e85e (patch) | |
tree | acf59c64399d7b497dec99fd9fdc501269da8548 /test_msgnet | |
parent | 3bf349ef7ca5cf341c7d1b1f02f5c0c338b7405c (diff) |
...
Diffstat (limited to 'test_msgnet')
-rw-r--r-- | test_msgnet/main.go | 17 |
1 files changed, 8 insertions, 9 deletions
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() |