diff options
Diffstat (limited to 'test_p2p_stress')
-rw-r--r-- | test_p2p_stress/main.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test_p2p_stress/main.go b/test_p2p_stress/main.go index 79b28b0..4534c4f 100644 --- a/test_p2p_stress/main.go +++ b/test_p2p_stress/main.go @@ -14,7 +14,13 @@ package main // int app_id; // uint64_t addr_id; // msgnetwork_conn_t *conn; -// } timerout_callback_context_t; +// } timeout_callback_context_t; +// timeout_callback_context_t *timeout_callback_context_new() { +// timeout_callback_context_t *ctx = malloc(sizeof(timeout_callback_context_t); +// ctx->conn = NULL; +// return ctx; +// } +// import "C" import ( @@ -151,7 +157,7 @@ func onReceiveAck(_msg *C.struct_msg_t, _conn *C.struct_msgnetwork_conn_t, userd if tc.state == seg_buff_size * 2 { sendRand(tc.state, app, conn) tc.state = -1 - ctx := (*C.struct_timeout_callback_context_t)(C.malloc(C.sizeof_struct_timeout_callback_context_t)) + ctx := C.timeout_callback_context_new() ctx.app_id = C.int(id) ctx.addr_id = C.uint64_t(addr) ctx.conn = (*C.struct_msgnetwork_conn_t)(conn) |