aboutsummaryrefslogtreecommitdiff
path: root/test/test_network.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_network.cpp')
-rw-r--r--test/test_network.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/test_network.cpp b/test/test_network.cpp
index e439bca..6a12117 100644
--- a/test/test_network.cpp
+++ b/test/test_network.cpp
@@ -89,16 +89,16 @@ struct MyNet: public MsgNetworkByteOp {
reg_handler(salticidae::generic_bind(
&MyNet::on_receive_hello, this, _1, _2));
- reg_conn_handler([this](ConnPool::Conn &conn, bool connected) {
+ reg_conn_handler([this](const ConnPool::conn_t &conn, bool connected) {
if (connected)
{
- if (conn.get_mode() == ConnPool::Conn::ACTIVE)
+ if (conn->get_mode() == ConnPool::Conn::ACTIVE)
{
printf("[%s] Connected, sending hello.\n",
this->name.c_str());
/* send the first message through this connection */
send_msg(MsgHello(this->name, "Hello there!"),
- static_cast<Conn &>(conn));
+ salticidae::static_pointer_cast<Conn>(conn));
}
else
printf("[%s] Accepted, waiting for greetings.\n",
@@ -108,12 +108,12 @@ struct MyNet: public MsgNetworkByteOp {
{
printf("[%s] Disconnected, retrying.\n", this->name.c_str());
/* try to reconnect to the same address */
- connect(conn.get_addr());
+ connect(conn->get_addr());
}
});
}
- void on_receive_hello(MsgHello &&msg, MyNet::Conn &conn) {
+ void on_receive_hello(MsgHello &&msg, const MyNet::conn_t &conn) {
printf("[%s] %s says %s\n",
name.c_str(),
msg.name.c_str(), msg.text.c_str());
@@ -123,8 +123,8 @@ struct MyNet: public MsgNetworkByteOp {
};
-void on_receive_ack(MsgAck &&msg, MyNet::Conn &conn) {
- auto net = static_cast<MyNet *>(conn.get_net());
+void on_receive_ack(MsgAck &&msg, const MyNet::conn_t &conn) {
+ auto net = static_cast<MyNet *>(conn->get_net());
printf("[%s] the peer knows\n", net->name.c_str());
}