@@ -31,16 +31,20 @@ namespace libp2p::transport {
31
31
} // namespace
32
32
33
33
TcpConnection::TcpConnection (boost::asio::io_context &ctx,
34
+ ProtoAddrVec layers,
34
35
boost::asio::ip::tcp::socket &&socket)
35
36
: context_(ctx),
37
+ layers_{std::move (layers)},
36
38
socket_ (std::move(socket)),
37
39
connection_phase_done_{false },
38
40
deadline_timer_ (context_) {
39
41
std::ignore = saveMultiaddresses ();
40
42
}
41
43
42
- TcpConnection::TcpConnection (boost::asio::io_context &ctx)
44
+ TcpConnection::TcpConnection (boost::asio::io_context &ctx,
45
+ ProtoAddrVec layers)
43
46
: context_(ctx),
47
+ layers_{std::move (layers)},
44
48
socket_ (context_),
45
49
connection_phase_done_{false },
46
50
deadline_timer_ (context_) {}
@@ -292,15 +296,15 @@ namespace libp2p::transport {
292
296
if (!local_multiaddress_) {
293
297
auto endpoint (socket_.local_endpoint (ec));
294
298
if (!ec) {
295
- OUTCOME_TRY (addr, detail::makeAddress (endpoint));
296
- local_multiaddress_ = std::move (addr );
299
+ BOOST_OUTCOME_TRY (local_multiaddress_,
300
+ detail::makeAddress (endpoint, &layers_) );
297
301
}
298
302
}
299
303
if (!remote_multiaddress_) {
300
304
auto endpoint (socket_.remote_endpoint (ec));
301
305
if (!ec) {
302
- OUTCOME_TRY (addr, detail::makeAddress (endpoint));
303
- remote_multiaddress_ = std::move (addr );
306
+ BOOST_OUTCOME_TRY (remote_multiaddress_,
307
+ detail::makeAddress (endpoint, &layers_) );
304
308
}
305
309
}
306
310
} else {
0 commit comments