diff options
author | Determinant <[email protected]> | 2018-07-31 20:48:37 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2018-07-31 20:48:37 -0400 |
commit | 8c965718031f0de6401aa30579da2e10afbcaf96 (patch) | |
tree | 6dbebc5f252ad93f2b28c24768bd547ffcdde31d /test/bench_network.cpp | |
parent | c9faab354fb314bacd9849503d8b4566a8c9ea62 (diff) |
optimize by replacing RcObj with pointers
Diffstat (limited to 'test/bench_network.cpp')
-rw-r--r-- | test/bench_network.cpp | 8 |
1 files changed, 4 insertions, 4 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++; } }; |