Skip to content

Commit

Permalink
fix a few shadowing variable warnings under Apple clang 16.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aldenml authored and arvidn committed Oct 25, 2024
1 parent 9fbe56a commit 26b0cc4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/rtc_signaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ rtc_signaling::connection& rtc_signaling::create_connection(rtc_offer_id const&
});

pc->onGatheringStateChange([weak_this = weak_from_this(), weak_pc = make_weak_ptr(pc), offer_id
, handler = std::move(handler)]
, handler_ = std::move(handler)]
(rtc::PeerConnection::GatheringState state)
{
// Warning: this is called from another thread
Expand All @@ -299,7 +299,7 @@ rtc_signaling::connection& rtc_signaling::create_connection(rtc_offer_id const&
{
auto& io_context = self->m_io_context;
auto description = *pc_->localDescription();
post(io_context, std::bind(std::move(handler), error_code{}, description));
post(io_context, std::bind(std::move(handler_), error_code{}, description));
}
});

Expand Down
14 changes: 7 additions & 7 deletions src/tracker_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,26 +309,26 @@ namespace libtorrent::aux {
{
// when we're shutting down, we don't really want to
// re-establish the persistent websocket connection just to
// announce "stopped", and advertize 0 offers. It may hang
// announce "stopped", and advertise 0 offers. It may hang
// shutdown.
post(ios, std::bind(&request_callback::tracker_request_error, cb, std::move(req)
, errors::torrent_aborted, operation_t::connect
, "", seconds32(0)));
}
cb->generate_rtc_offers(req.num_want
, [this, &ios, req = std::move(req), c](error_code const& ec
, [this, &ios, request = std::move(req), c](error_code const& ec
, std::vector<aux::rtc_offer> offers) mutable
{
if (!ec) req.offers = std::move(offers);
if (!ec) request.offers = std::move(offers);

auto it = m_websocket_conns.find(req.url);
auto it = m_websocket_conns.find(request.url);
if (it != m_websocket_conns.end() && it->second->is_started()) {
it->second->queue_request(std::move(req), c);
it->second->queue_request(std::move(request), c);
} else {
auto con = std::make_shared<aux::websocket_tracker_connection>(
ios, *this, std::move(req), c);
ios, *this, std::move(request), c);
con->start();
m_websocket_conns[req.url] = con;
m_websocket_conns[request.url] = con;
}
});
return;
Expand Down
8 changes: 4 additions & 4 deletions src/websocket_tracker_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,13 @@ void websocket_tracker_connection::send_pending()
auto [msg, callback] = std::move(m_pending.front());
m_pending.pop();

std::visit([this, callback = callback](auto const& m)
std::visit([this, cb = callback](auto const& m)
{
// Update requester and store callback
if (callback.lock())
if (cb.lock())
{
m_requester = callback;
m_callbacks[m.info_hash] = std::move(callback);
m_requester = cb;
m_callbacks[m.info_hash] = std::move(cb);
}

do_send(m);
Expand Down

0 comments on commit 26b0cc4

Please sign in to comment.