diff --git a/src/jamidht/connectionmanager.cpp b/src/jamidht/connectionmanager.cpp index ee210b8bfc541d093fe0cea5f6e30cbc5ca20c43..fd73ea9bc73938355f616a91ad1fa4bbdcf15051 100644 --- a/src/jamidht/connectionmanager.cpp +++ b/src/jamidht/connectionmanager.cpp @@ -472,13 +472,13 @@ ConnectionManager::Impl::connectDevice(const std::shared_ptr<dht::crypto::Certif }; // If no socket exists, we need to initiate an ICE connection. - sthis->account.getIceOptions(std::move([w, + sthis->account.getIceOptions([w, cbId, deviceId = std::move(deviceId), name = std::move(name), cert = std::move(cert), vid, - eraseInfo](auto ice_config) { + eraseInfo](auto&& ice_config) { auto sthis = w.lock(); if (!sthis) return; @@ -552,7 +552,7 @@ ConnectionManager::Impl::connectDevice(const std::shared_ptr<dht::crypto::Certif pending.cb(nullptr, deviceId); eraseInfo(); } - })); + }); }); } @@ -826,7 +826,7 @@ ConnectionManager::Impl::onDhtPeerRequest(const PeerConnectionRequest& req, } // Because the connection is accepted, create an ICE socket. - account.getIceOptions(std::move([w=weak(), req](auto ice_config) { + account.getIceOptions([w=weak(), req](auto&& ice_config) { auto deviceId = req.from.toString(); auto shared = w.lock(); if (!shared) @@ -898,7 +898,7 @@ ConnectionManager::Impl::onDhtPeerRequest(const PeerConnectionRequest& req, shared->connReadyCb_(req.from, "", nullptr); eraseInfo(); } - })); + }); } void diff --git a/src/jamidht/jamiaccount.cpp b/src/jamidht/jamiaccount.cpp index 35c4955f8c89e608848c579e57c7190841d8c7f9..28b3103767d3919e58dd5e6626e18f6639f20788 100644 --- a/src/jamidht/jamiaccount.cpp +++ b/src/jamidht/jamiaccount.cpp @@ -718,7 +718,7 @@ JamiAccount::onConnectedOutgoingCall(const std::shared_ptr<SIPCall>& call, return; JAMI_DBG("[call:%s] outgoing call connected to %s", call->getCallId().c_str(), to_id.c_str()); - getIceOptions(std::move([=](auto opts) { + getIceOptions([=](auto&& opts) { opts.onInitDone = [w = weak(), target = std::move(target), call](bool ok) { if (!ok) { JAMI_ERR("ICE medias are not initialized"); @@ -780,7 +780,7 @@ JamiAccount::onConnectedOutgoingCall(const std::shared_ptr<SIPCall>& call, call->setIPToIP(true); call->setPeerNumber(to_id); call->initIceMediaTransport(true, std::move(opts)); - })); + }); } bool @@ -2696,7 +2696,7 @@ JamiAccount::incomingCall(dht::IceCandidates&& msg, return; } auto callId = call->getCallId(); - getIceOptions(std::move([=](auto iceOptions) { + getIceOptions([=](auto&& iceOptions) { iceOptions.onNegoDone = [callId, w = weak()](bool) { runOnMainThread([callId, w]() { if (auto shared = w.lock()) @@ -2736,7 +2736,7 @@ JamiAccount::incomingCall(dht::IceCandidates&& msg, account->replyToIncomingIceMsg(call, ice, ice_tcp, msg, from_cert, from); return false; }); - })); + }); } void @@ -3669,7 +3669,7 @@ JamiAccount::onIsComposing(const std::string& peer, bool isWriting) } void -JamiAccount::getIceOptions(std::function<void(IceTransportOptions)> cb) noexcept +JamiAccount::getIceOptions(std::function<void(IceTransportOptions&&)> cb) noexcept { storeActiveIpAddress([this, cb=std::move(cb)] { auto opts = SIPAccountBase::getIceOptions(); diff --git a/src/jamidht/jamiaccount.h b/src/jamidht/jamiaccount.h index c27e62dacebf2891e2695abcbb0cfe64af94d2de..4e30c5bdd21c55a2cedb95b19d94d8c580de4bf4 100644 --- a/src/jamidht/jamiaccount.h +++ b/src/jamidht/jamiaccount.h @@ -440,7 +440,7 @@ public: /** * Create and return ICE options. */ - void getIceOptions(std::function<void(IceTransportOptions)> cb) noexcept; + void getIceOptions(std::function<void(IceTransportOptions&&)> cb) noexcept; #ifdef DRING_TESTABLE ConnectionManager& connectionManager() { return *connectionManager_; } diff --git a/src/sip/sipaccountbase.cpp b/src/sip/sipaccountbase.cpp index 1017a494ac30a502e13c6629cc572a1cb674f68a..92f5ce85aede17b92bb8163695866c388ae48cbb 100644 --- a/src/sip/sipaccountbase.cpp +++ b/src/sip/sipaccountbase.cpp @@ -465,7 +465,7 @@ SIPAccountBase::generateVideoPort() const } #endif -const IceTransportOptions +IceTransportOptions SIPAccountBase::getIceOptions() const noexcept { IceTransportOptions opts; diff --git a/src/sip/sipaccountbase.h b/src/sip/sipaccountbase.h index 447f142f1b1f2b56145e653d7507a118f89df609..62d734605d65d496f5820ce5234f700e9c7eda69 100644 --- a/src/sip/sipaccountbase.h +++ b/src/sip/sipaccountbase.h @@ -243,7 +243,7 @@ public: void setStunServer(const std::string& srv) { stunServer_ = srv; } - const IceTransportOptions getIceOptions() const noexcept; + IceTransportOptions getIceOptions() const noexcept; virtual void sendTextMessage(const std::string& to, const std::map<std::string, std::string>& payloads,