aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-07-01 23:35:17 -0400
committerDeterminant <[email protected]>2019-07-01 23:35:17 -0400
commit53f776997d0e92650b9f3a16224cef1c0c76b716 (patch)
treede7c0a20dd4ba1d4bc5ea229e723ab8608ed94af /test
parent85b9affbce70ac4b5922158802b227a42c42a203 (diff)
add async id for error handling
Diffstat (limited to 'test')
-rw-r--r--test/bench_network.cpp2
-rw-r--r--test/bench_network_tls.cpp2
-rw-r--r--test/test_msgnet.cpp6
-rw-r--r--test/test_msgnet_c.c6
-rw-r--r--test/test_msgnet_tls.cpp6
-rw-r--r--test/test_p2p.cpp6
-rw-r--r--test/test_p2p_stress.cpp6
-rw-r--r--test/test_p2p_tls.cpp6
8 files changed, 20 insertions, 20 deletions
diff --git a/test/bench_network.cpp b/test/bench_network.cpp
index 5575a66..1021ec4 100644
--- a/test/bench_network.cpp
+++ b/test/bench_network.cpp
@@ -117,7 +117,7 @@ struct MyNet: public MsgNetworkByteOp {
{
printf("[%s] disconnected, retrying.\n", this->name.c_str());
/* try to reconnect to the same address */
- connect(conn->get_addr(), false);
+ connect(conn->get_addr());
}
return true;
});
diff --git a/test/bench_network_tls.cpp b/test/bench_network_tls.cpp
index b5280b4..7c682ba 100644
--- a/test/bench_network_tls.cpp
+++ b/test/bench_network_tls.cpp
@@ -119,7 +119,7 @@ struct MyNet: public MsgNetworkByteOp {
{
printf("[%s] disconnected, retrying.\n", this->name.c_str());
/* try to reconnect to the same address */
- connect(conn->get_addr(), false);
+ connect(conn->get_addr());
}
return true;
});
diff --git a/test/test_msgnet.cpp b/test/test_msgnet.cpp
index 50e35dc..9b52f85 100644
--- a/test/test_msgnet.cpp
+++ b/test/test_msgnet.cpp
@@ -108,7 +108,7 @@ struct MyNet: public MsgNetworkByteOp {
{
printf("[%s] disconnected, retrying.\n", this->name.c_str());
/* try to reconnect to the same address */
- connect(conn->get_addr(), false);
+ connect(conn->get_addr());
}
return true;
});
@@ -148,8 +148,8 @@ int main() {
bob.listen(bob_addr);
/* try to connect once */
- alice.connect(bob_addr, false);
- bob.connect(alice_addr, false);
+ alice.connect(bob_addr);
+ bob.connect(alice_addr);
/* the main loop can be shutdown by ctrl-c or kill */
auto shutdown = [&](int) {ec.stop();};
diff --git a/test/test_msgnet_c.c b/test/test_msgnet_c.c
index 1417d2b..2ee9443 100644
--- a/test/test_msgnet_c.c
+++ b/test/test_msgnet_c.c
@@ -139,7 +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, false, &err); check_err(&err);
+ msgnetwork_connect(net, addr);
}
return true;
}
@@ -194,8 +194,8 @@ int main() {
msgnetwork_listen(bob.net, bob_addr, &err); check_err(&err);
/* try to connect once */
- msgnetwork_conn_free(msgnetwork_connect(alice.net, bob_addr, false, &err)); check_err(&err);
- msgnetwork_conn_free(msgnetwork_connect(bob.net, alice_addr, false, &err)); check_err(&err);
+ msgnetwork_connect(alice.net, bob_addr);
+ msgnetwork_connect(bob.net, alice_addr);
netaddr_free(alice_addr);
netaddr_free(bob_addr);
diff --git a/test/test_msgnet_tls.cpp b/test/test_msgnet_tls.cpp
index a779ba5..07fe6ac 100644
--- a/test/test_msgnet_tls.cpp
+++ b/test/test_msgnet_tls.cpp
@@ -121,7 +121,7 @@ struct MyNet: public MsgNetworkByteOp {
{
printf("[%s] disconnected, retrying.\n", this->name.c_str());
/* try to reconnect to the same address */
- connect(conn->get_addr(), false);
+ connect(conn->get_addr());
}
return res;
});
@@ -161,8 +161,8 @@ int main() {
bob.listen(bob_addr);
/* try to connect once */
- alice.connect(bob_addr, false);
- bob.connect(alice_addr, false);
+ alice.connect(bob_addr);
+ bob.connect(alice_addr);
/* the main loop can be shutdown by ctrl-c or kill */
auto shutdown = [&](int) {ec.stop();};
diff --git a/test/test_p2p.cpp b/test/test_p2p.cpp
index 3a30ed2..d097562 100644
--- a/test/test_p2p.cpp
+++ b/test/test_p2p.cpp
@@ -80,12 +80,12 @@ struct Net {
net->reg_handler([this](const MsgText &msg, const PeerNetwork::conn_t &) {
fprintf(stdout, "net %lu: peer %lu says %s\n", this->id, msg.id, msg.text.c_str());
});
- net->reg_error_handler([this](const std::exception_ptr _err, bool fatal) {
+ net->reg_error_handler([this](const std::exception_ptr _err, bool fatal, int32_t async_id) {
try {
std::rethrow_exception(_err);
} catch (const std::exception &err) {
- fprintf(stdout, "net %lu: captured %s error during an async call: %s\n",
- this->id, fatal ? "fatal" : "recoverable", err.what());
+ fprintf(stdout, "net %lu: captured %s error during an async call %d: %s\n",
+ this->id, fatal ? "fatal" : "recoverable", async_id, err.what());
}
});
net->reg_peer_handler([this](const PeerNetwork::conn_t &conn, bool connected) {
diff --git a/test/test_p2p_stress.cpp b/test/test_p2p_stress.cpp
index fc9a430..9fe1b83 100644
--- a/test/test_p2p_stress.cpp
+++ b/test/test_p2p_stress.cpp
@@ -128,12 +128,12 @@ void install_proto(AppContext &app, const size_t &seg_buff_size) {
send_rand(tc.state, conn, tc);
}
});
- net.reg_error_handler([ec](const std::exception_ptr _err, bool fatal) {
+ net.reg_error_handler([ec](const std::exception_ptr _err, bool fatal, int32_t async_id) {
try {
std::rethrow_exception(_err);
} catch (const std::exception & err) {
- SALTICIDAE_LOG_WARN("captured %s error: %s",
- fatal ? "fatal" : "recoverable", err.what());
+ SALTICIDAE_LOG_WARN("captured %s error during async call %d: %s",
+ fatal ? "fatal" : "recoverable", async_id, err.what());
}
});
net.reg_handler([&](MsgRand &&msg, const MyNet::conn_t &conn) {
diff --git a/test/test_p2p_tls.cpp b/test/test_p2p_tls.cpp
index f814643..698bbac 100644
--- a/test/test_p2p_tls.cpp
+++ b/test/test_p2p_tls.cpp
@@ -105,12 +105,12 @@ struct Net {
}
return true;
});
- net->reg_error_handler([this](const std::exception_ptr _err, bool fatal) {
+ net->reg_error_handler([this](const std::exception_ptr _err, bool fatal, int32_t async_id) {
try {
std::rethrow_exception(_err);
} catch (const std::exception &err) {
- fprintf(stdout, "net %lu: captured %s error during an async call: %s\n",
- this->id, fatal ? "fatal" : "recoverable", err.what());
+ fprintf(stdout, "net %lu: captured %s error during an async call %d: %s\n",
+ this->id, fatal ? "fatal" : "recoverable", async_id, err.what());
}
});
net->reg_peer_handler([this](const PeerNetwork::conn_t &conn, bool connected) {