aboutsummaryrefslogtreecommitdiff
path: root/test_p2p_stress
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2019-06-11 01:59:04 -0400
committerDeterminant <ted.sybil@gmail.com>2019-06-11 01:59:04 -0400
commit1b2215ae2c792f96765a15c7ffcc6f20e3046cc7 (patch)
treee42e4d9f86c39130387da65765ca2a4b315722d9 /test_p2p_stress
parentdf87359ec575622687b5f6b8319fb30ba4340caf (diff)
fix slice bugs
Diffstat (limited to 'test_p2p_stress')
-rw-r--r--test_p2p_stress/main.go10
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)