aboutsummaryrefslogtreecommitdiff
path: root/test_p2p_stress
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-06-22 01:45:37 -0400
committerDeterminant <[email protected]>2019-06-22 01:45:37 -0400
commit66914cd88bd822d3399e754f43a42906c043f1fd (patch)
tree77751cf4f2b106cb8fe2dd66f546502a7a099217 /test_p2p_stress
parent988748a02d39228017e36f7a5c3415b19b31657d (diff)
support TLS; change some API
Diffstat (limited to 'test_p2p_stress')
-rw-r--r--test_p2p_stress/main.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/test_p2p_stress/main.go b/test_p2p_stress/main.go
index 9e0757f..69f9d6c 100644
--- a/test_p2p_stress/main.go
+++ b/test_p2p_stress/main.go
@@ -240,6 +240,7 @@ func onTerm(_ C.int, _ unsafe.Pointer) {
func main() {
ec = salticidae.NewEventContext()
+ err := salticidae.NewError()
var addrs []salticidae.NetAddr
for i := 0; i < 5; i++ {
@@ -256,22 +257,23 @@ func main() {
ids = make([](*C.int), len(addrs))
for i, addr := range addrs {
ec := salticidae.NewEventContext()
+ net := salticidae.NewPeerNetwork(ec, netconfig, &err); checkError(&err)
apps[i] = AppContext {
addr: addr,
ec: ec,
- net: salticidae.NewPeerNetwork(ec, netconfig),
+ net: net,
tcall: salticidae.NewThreadCall(ec),
tc: make(map[uint64] *TestContext),
}
ids[i] = (*C.int)(C.malloc(C.sizeof_int))
*ids[i] = C.int(i)
_i := unsafe.Pointer(ids[i])
- net := apps[i].net.AsMsgNetwork()
- 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()
+ mnet := net.AsMsgNetwork()
+ mnet.RegHandler(MSG_OPCODE_RAND, salticidae.MsgNetworkMsgCallback(C.onReceiveRand), _i)
+ mnet.RegHandler(MSG_OPCODE_ACK, salticidae.MsgNetworkMsgCallback(C.onReceiveAck), _i)
+ mnet.RegConnHandler(salticidae.MsgNetworkConnCallback(C.connHandler), _i)
+ mnet.RegErrorHandler(salticidae.MsgNetworkErrorCallback(C.errorHandler), _i)
+ mnet.Start()
}
threads.Add(len(apps))
@@ -280,7 +282,7 @@ func main() {
go func() {
err := salticidae.NewError()
a := &apps[app_id]
- a.net.Listen(a.addr, &err)
+ a.net.Listen(a.addr, &err); checkError(&err)
for _, addr := range addrs {
if !addr.IsEq(a.addr) {
a.net.AddPeer(addr)