getIceOptions: cleanup

Change-Id: Ibc4a5181ef33e4f09beeaa0ecbe09cf9db4e9996
This commit is contained in:
Adrien Béraud
2021-05-04 12:08:15 -04:00
parent ab8af57625
commit 0f491796ba
5 changed files with 13 additions and 13 deletions

View File

@ -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

View File

@ -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();

View File

@ -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_; }

View File

@ -465,7 +465,7 @@ SIPAccountBase::generateVideoPort() const
}
#endif
const IceTransportOptions
IceTransportOptions
SIPAccountBase::getIceOptions() const noexcept
{
IceTransportOptions opts;

View File

@ -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,