diff options
author | Determinant <[email protected]> | 2019-06-14 18:17:53 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-06-14 18:17:53 -0400 |
commit | 35d6ada17b298a9ce51c2e432596b91d7c6c4cc3 (patch) | |
tree | ab259080619dcdd654a3ef53325839fa48944f5b /test_p2p_stress | |
parent | cb133a379998112600ea1504b556484a417cf48a (diff) |
minor fix
Diffstat (limited to 'test_p2p_stress')
-rw-r--r-- | test_p2p_stress/main.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test_p2p_stress/main.go b/test_p2p_stress/main.go index 6670f03..7cda52d 100644 --- a/test_p2p_stress/main.go +++ b/test_p2p_stress/main.go @@ -9,6 +9,7 @@ package main // void onReceiveAck(msg_t *, msgnetwork_conn_t *, void *); // void onStopLoop(threadcall_handle_t *, void *); // void connHandler(msgnetwork_conn_t *, bool, void *); +// void errorHandler(SalticidaeCError *, bool, void *); // void onTimeout(timerev_t *, void *); // typedef struct timeout_callback_context_t { // int app_id; @@ -235,6 +236,14 @@ func connHandler(_conn *C.struct_msgnetwork_conn_t, connected C.bool, userdata u } } +//export errorHandler +func errorHandler(_err *C.struct_SalticidaeCError, fatal C.bool, _ unsafe.Pointer) { + err := (*salticidae.Error)(unsafe.Pointer(_err)) + s := "recoverable" + if fatal { s = "fatal" } + fmt.Printf("Captured %s error during an async call: %s\n", s, salticidae.StrError(err.GetCode())) +} + //export onStopLoop func onStopLoop(_ *C.threadcall_handle_t, userdata unsafe.Pointer) { ec := salticidae.EventContext(userdata) @@ -285,6 +294,7 @@ func main() { net.RegHandler(MSG_OPCODE_RAND, salticidae.MsgNetworkMsgCallback(C.onReceiveRand), _i) net.RegHandler(MSG_OPCODE_ACK, salticidae.MsgNetworkMsgCallback(C.onReceiveAck), _i) net.RegConnHandler(salticidae.MsgNetworkConnCallback(C.connHandler), _i) + net.RegErrorHandler(salticidae.MsgNetworkErrorCallback(C.errorHandler), _i) net.Start() } netconfig.Free() |