diff options
author | Determinant <[email protected]> | 2019-06-21 17:54:32 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-06-21 17:54:32 -0400 |
commit | 2c159f5a2d5fa34de4040fd262754c56b6decbbd (patch) | |
tree | 72d45e38352f84d0d27cfbd36c06603045ab57b5 /test/test_msgnet_c.c | |
parent | ff904b23147e72db4f7f77f8269242d9a5a0859e (diff) |
adjust C API
Diffstat (limited to 'test/test_msgnet_c.c')
-rw-r--r-- | test/test_msgnet_c.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/test/test_msgnet_c.c b/test/test_msgnet_c.c index aeedd99..f938c82 100644 --- a/test/test_msgnet_c.c +++ b/test/test_msgnet_c.c @@ -139,8 +139,7 @@ bool conn_handler(const msgnetwork_conn_t *conn, bool connected, void *userdata) printf("[%s] Disconnected, retrying.\n", name); /* try to reconnect to the same address */ const netaddr_t *addr = msgnetwork_conn_get_addr(conn); - msgnetwork_connect(net, addr, &err); - check_err(&err); + msgnetwork_connect(net, addr, &err); check_err(&err); } return true; } @@ -155,8 +154,9 @@ void error_handler(const SalticidaeCError *err, bool fatal, void *userdata) { MyNet gen_mynet(const eventcontext_t *ec, const char *name) { MyNet res; + SalticidaeCError err; const msgnetwork_config_t *netconfig = msgnetwork_config_new(); - res.net = msgnetwork_new(ec, netconfig); + res.net = msgnetwork_new(ec, netconfig, &err); check_err(&err); msgnetwork_config_free(netconfig); res.name = name; return res; @@ -190,16 +190,12 @@ int main() { msgnetwork_start(bob.net); /* accept incoming connections */ - msgnetwork_listen(alice.net, alice_addr, &err); - check_err(&err); - msgnetwork_listen(bob.net, bob_addr, &err); - check_err(&err); + msgnetwork_listen(alice.net, alice_addr, &err); check_err(&err); + msgnetwork_listen(bob.net, bob_addr, &err); check_err(&err); /* try to connect once */ - msgnetwork_conn_free(msgnetwork_connect(alice.net, bob_addr, &err)); - check_err(&err); - msgnetwork_conn_free(msgnetwork_connect(bob.net, alice_addr, &err)); - check_err(&err); + msgnetwork_conn_free(msgnetwork_connect(alice.net, bob_addr, &err)); check_err(&err); + msgnetwork_conn_free(msgnetwork_connect(bob.net, alice_addr, &err)); check_err(&err); netaddr_free(alice_addr); netaddr_free(bob_addr); |