Skip to content

Commit

Permalink
misc: fix various warnings
Browse files Browse the repository at this point in the history
Change-Id: Ifef17404e31f7478d310179255092d0e17743b16
  • Loading branch information
aberaud committed Oct 24, 2024
1 parent 792b18e commit 08fcd48
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/connectionmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,9 @@ class ConnectionManager::Impl : public std::enable_shared_from_this<ConnectionMa
{
public:
explicit Impl(std::shared_ptr<ConnectionManager::Config> config_)
: config_ {std::move(createConfig(config_))}
: treatedMessages_ {config_->cachePath / "treatedMessages"}
, config_ {createConfig(config_)}
, rand_ {config_->rng ? *config_->rng : dht::crypto::getSeededRandomEngine<std::mt19937_64>()}
, treatedMessages_ {config_->cachePath / "treatedMessages"}
{
if(!config_->ioContext) {
config_->ioContext = std::make_shared<asio::io_context>();
Expand Down Expand Up @@ -1572,7 +1572,7 @@ ConnectionManager::Impl::addNewMultiplexedSocket(const std::weak_ptr<DeviceInfo>
std::unique_lock lkc(info->mutex_);
auto ids = std::move(info->pendingCbs_);
auto [ops, retry] = deviceInfo->resetPendingOperations(ids);
auto erased = deviceInfo->info.erase(vid);
deviceInfo->info.erase(vid);
if (!retry && deviceInfo->empty()) {
if (auto sthis = w.lock())
sthis->infos_.removeDeviceInfo(deviceInfo->deviceId);
Expand Down
2 changes: 1 addition & 1 deletion src/multiplexed_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ class MultiplexedSocket::Impl
std::unique_ptr<TlsSocketEndpoint> ep,
std::shared_ptr<dht::log::Logger> logger)
: parent_(parent)
, logger_(std::move(logger))
, ctx_(std::move(ctx))
, deviceId(deviceId)
, endpoint(std::move(ep))
, nextChannel_(endpoint->isInitiator() ? 0x0001u : 0x8000u)
, logger_(std::move(logger))
, eventLoopThread_ {[this] {
try {
eventLoop();
Expand Down
2 changes: 1 addition & 1 deletion src/upnp/upnp_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ constexpr static uint16_t UPNP_UDP_PORT_MAX {UPNP_UDP_PORT_MIN + 5000};
UPnPContext::UPnPContext(const std::shared_ptr<asio::io_context>& ioContext, const std::shared_ptr<dht::log::Logger>& logger)
: ctx(createIoContext(ioContext, logger))
, logger_(logger)
, connectivityChangedTimer_(*ctx)
, mappingRenewalTimer_(*ctx)
, renewalSchedulingTimer_(*ctx)
, syncTimer_(*ctx)
, connectivityChangedTimer_(*ctx)
, igdDiscoveryTimer_(*ctx)

{
Expand Down
2 changes: 1 addition & 1 deletion tools/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ connectionManagerConfig(dht::crypto::Identity identity,
config->upnpCtrl = controller;
}

return std::move(config);
return config;
}
template<typename T>
void
Expand Down
12 changes: 6 additions & 6 deletions tools/dnc/dnc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Dnc::Dnc(dht::crypto::Identity identity,
const std::map<std::string, std::vector<int>> authorized_services,
const bool enable_upnp)
:logger(verbose ? dht::log::getStdLogger() : nullptr),
ioContext(std::make_shared<asio::io_context>()),
iceFactory(std::make_shared<IceTransportFactory>(logger))
iceFactory(std::make_shared<IceTransportFactory>(logger)),
ioContext(std::make_shared<asio::io_context>())
{

certStore = std::make_shared<tls::CertificateStore>(cachePath()/"certStore", logger);
Expand Down Expand Up @@ -157,16 +157,16 @@ Dnc::Dnc(dht::crypto::Identity identity,
asio::async_connect(
*socket,
endpoints,
[this, socket, mtlxSocket](const std::error_code& error,
[socket, mtlxSocket](const std::error_code& error,
const asio::ip::tcp::endpoint& ep) {
if (!error) {
Log("Connected!\n");
mtlxSocket->setOnRecv([socket, this](const uint8_t* data, size_t size) {
mtlxSocket->setOnRecv([socket](const uint8_t* data, size_t size) {
auto data_copy = std::make_shared<std::vector<uint8_t>>(data,
data + size);
asio::async_write(*socket,
asio::buffer(*data_copy),
[data_copy, this](const std::error_code& error,
[data_copy](const std::error_code& error,
std::size_t bytesWritten) {
if (error) {
Log("Write error: {}\n", error.message());
Expand Down Expand Up @@ -209,7 +209,7 @@ Dnc::Dnc(dht::crypto::Identity identity,
connectionManager->connectDevice(
peer_id, name, [&](std::shared_ptr<ChannelSocket> socket, const dht::InfoHash&) {
if (socket) {
socket->setOnRecv([this, socket](const uint8_t* data, size_t size) {
socket->setOnRecv([socket](const uint8_t* data, size_t size) {
std::cout.write((const char*) data, size);
std::cout.flush();
return size;
Expand Down
6 changes: 3 additions & 3 deletions tools/dsh/dsh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ dhtnet::Dsh::Dsh(dht::crypto::Identity identity,
const std::string& turn_realm,
bool anonymous)
:logger(dht::log::getStdLogger()),
ioContext(std::make_shared<asio::io_context>()),
iceFactory(std::make_shared<IceTransportFactory>(logger)),
certStore(std::make_shared<tls::CertificateStore>(cachePath()/"certstore", logger)),
iceFactory(std::make_shared<IceTransportFactory>(logger)),
ioContext(std::make_shared<asio::io_context>()),
trustStore(std::make_shared<tls::TrustStore>(*certStore))
{
auto ca = identity.second->issuer;
Expand Down Expand Up @@ -223,7 +223,7 @@ dhtnet::Dsh::Dsh(dht::crypto::Identity identity,
connectionManager->connectDevice(
peer_id, binary, [&](std::shared_ptr<ChannelSocket> socket, const dht::InfoHash&) {
if (socket) {
socket->setOnRecv([this, socket](const uint8_t* data, size_t size) {
socket->setOnRecv([socket](const uint8_t* data, size_t size) {
std::cout.write((const char*) data, size);
std::cout.flush();
return size;
Expand Down

0 comments on commit 08fcd48

Please sign in to comment.