@@ -23,16 +23,20 @@ namespace libp2p::transport {
23
23
} // namespace
24
24
25
25
TcpConnection::TcpConnection (boost::asio::io_context &ctx,
26
+ ProtoAddrVec layers,
26
27
boost::asio::ip::tcp::socket &&socket)
27
28
: context_(ctx),
29
+ layers_{std::move (layers)},
28
30
socket_ (std::move(socket)),
29
31
connection_phase_done_{false },
30
32
deadline_timer_ (context_) {
31
33
std::ignore = saveMultiaddresses ();
32
34
}
33
35
34
- TcpConnection::TcpConnection (boost::asio::io_context &ctx)
36
+ TcpConnection::TcpConnection (boost::asio::io_context &ctx,
37
+ ProtoAddrVec layers)
35
38
: context_(ctx),
39
+ layers_{std::move (layers)},
36
40
socket_ (context_),
37
41
connection_phase_done_{false },
38
42
deadline_timer_ (context_) {}
@@ -281,15 +285,15 @@ namespace libp2p::transport {
281
285
if (!local_multiaddress_) {
282
286
auto endpoint (socket_.local_endpoint (ec));
283
287
if (!ec) {
284
- OUTCOME_TRY (addr, detail::makeAddress (endpoint));
285
- local_multiaddress_ = std::move (addr );
288
+ BOOST_OUTCOME_TRY (local_multiaddress_,
289
+ detail::makeAddress (endpoint, &layers_) );
286
290
}
287
291
}
288
292
if (!remote_multiaddress_) {
289
293
auto endpoint (socket_.remote_endpoint (ec));
290
294
if (!ec) {
291
- OUTCOME_TRY (addr, detail::makeAddress (endpoint));
292
- remote_multiaddress_ = std::move (addr );
295
+ BOOST_OUTCOME_TRY (remote_multiaddress_,
296
+ detail::makeAddress (endpoint, &layers_) );
293
297
}
294
298
}
295
299
} else {
0 commit comments