aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/bench_network.cpp8
-rw-r--r--test/test_network.cpp10
2 files changed, 9 insertions, 9 deletions
diff --git a/test/bench_network.cpp b/test/bench_network.cpp
index 0276629..c2406d5 100644
--- a/test/bench_network.cpp
+++ b/test/bench_network.cpp
@@ -109,8 +109,8 @@ struct MyNet: public MsgNetworkByteOp {
net->name.c_str());
/* send the first message through this connection */
net->ev_period_send = Event(net->ec, -1, 0,
- [net, conn = self()](int, short) {
- net->send_msg(MsgBytes(256), conn);
+ [net, this](int, short) {
+ net->send_msg(MsgBytes(256), this);
net->ev_period_send.add_with_timeout(0);
});
net->ev_period_send.add_with_timeout(0);
@@ -122,18 +122,18 @@ struct MyNet: public MsgNetworkByteOp {
}
void on_teardown() override {
auto net = get_net();
+ net->ev_period_send = Event();
printf("[%s] Disconnected, retrying.\n", net->name.c_str());
/* try to reconnect to the same address */
net->connect(get_addr());
}
};
- using conn_t = salticidae::RcObj<Conn>;
salticidae::ConnPool::Conn *create_conn() override {
return new Conn();
}
- void on_receive_bytes(MsgBytes &&msg, conn_t conn) {
+ void on_receive_bytes(MsgBytes &&msg, const Conn *conn) {
nrecv++;
}
};
diff --git a/test/test_network.cpp b/test/test_network.cpp
index 8c1d0db..49a13c2 100644
--- a/test/test_network.cpp
+++ b/test/test_network.cpp
@@ -89,7 +89,7 @@ struct MyNet: public MsgNetworkByteOp {
reg_handler(salticidae::handler_bind(
&MyNet::on_receive_hello, this, _1, _2));
- reg_conn_handler([this](const ConnPool::conn_t &conn) {
+ reg_conn_handler([this](ConnPool::Conn *conn) {
if (conn->get_fd() != -1)
{
if (conn->get_mode() == ConnPool::Conn::ACTIVE)
@@ -98,7 +98,7 @@ struct MyNet: public MsgNetworkByteOp {
this->name.c_str());
/* send the first message through this connection */
send_msg(MsgHello(this->name, "Hello there!"),
- salticidae::static_pointer_cast<Conn>(conn));
+ static_cast<Conn *>(conn));
}
else
printf("[%s] Accepted, waiting for greetings.\n",
@@ -117,7 +117,7 @@ struct MyNet: public MsgNetworkByteOp {
return new Conn();
}
- void on_receive_hello(MsgHello &&msg, MyNet::conn_t conn) {
+ void on_receive_hello(MsgHello &&msg, MyNet::Conn *conn) {
printf("[%s] %s says %s\n",
name.c_str(),
msg.name.c_str(), msg.text.c_str());
@@ -126,8 +126,8 @@ struct MyNet: public MsgNetworkByteOp {
}
};
-
-void on_receive_ack(MsgAck &&msg, MyNet::conn_t conn) {
+
+void on_receive_ack(MsgAck &&msg, MyNet::Conn *conn) {
auto net = static_cast<MyNet *>(conn->get_net());
printf("[%s] the peer knows\n", net->name.c_str());
}