aboutsummaryrefslogtreecommitdiff
path: root/test_msgnet
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_msgnet
parent988748a02d39228017e36f7a5c3415b19b31657d (diff)
support TLS; change some API
Diffstat (limited to 'test_msgnet')
-rw-r--r--test_msgnet/main.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/test_msgnet/main.go b/test_msgnet/main.go
index 66d7287..065b773 100644
--- a/test_msgnet/main.go
+++ b/test_msgnet/main.go
@@ -113,7 +113,7 @@ func connHandler(_conn *C.struct_msgnetwork_conn_t, connected C.bool, _ unsafe.P
} else {
fmt.Printf("[%s] Disconnected, retrying.\n", name)
err := salticidae.NewError()
- net.Connect(conn.GetAddr(), &err)
+ net.Connect(conn.GetAddr(), false, &err)
}
}
@@ -127,20 +127,18 @@ func errorHandler(_err *C.struct_SalticidaeCError, fatal C.bool, _ unsafe.Pointe
func genMyNet(ec salticidae.EventContext, name string,
myAddr salticidae.NetAddr, otherAddr salticidae.NetAddr) MyNet {
+ err := salticidae.NewError()
netconfig := salticidae.NewMsgNetworkConfig()
- n := MyNet {
- net: salticidae.NewMsgNetwork(ec, netconfig),
- name: name,
- }
+ net := salticidae.NewMsgNetwork(ec, netconfig, &err); checkError(&err)
+ n := MyNet { net: net, name: name }
n.net.RegHandler(MSG_OPCODE_HELLO, salticidae.MsgNetworkMsgCallback(C.onReceiveHello), nil)
n.net.RegHandler(MSG_OPCODE_ACK, salticidae.MsgNetworkMsgCallback(C.onReceiveAck), nil)
n.net.RegConnHandler(salticidae.MsgNetworkConnCallback(C.connHandler), nil)
n.net.RegErrorHandler(salticidae.MsgNetworkErrorCallback(C.errorHandler), nil)
n.net.Start()
- err := salticidae.NewError()
n.net.Listen(myAddr, &err); checkError(&err)
- n.net.Connect(otherAddr, &err); checkError(&err)
+ n.net.Connect(otherAddr, false, &err); checkError(&err)
return n
}