Commit 7357773b authored by Andrea Gianarda's avatar Andrea Gianarda
Browse files

Prevent log of findDevice failure in some situations

parent d35140e7
......@@ -143,7 +143,7 @@ bool Conference::addParticipantDevice(std::shared_ptr<LinphonePrivate::Call> cal
const Address * remoteContact = static_pointer_cast<MediaSession>(call->getActiveSession())->getRemoteContactAddress();
if (remoteContact) {
// If device is not found, then add it
if (p->findDevice(*remoteContact) == nullptr) {
if (p->findDevice(*remoteContact, false) == nullptr) {
lInfo() << "Adding device with address " << remoteContact->asString() << " to participant " << p.get();
shared_ptr<ParticipantDevice> device = p->addDevice(*remoteContact);
_linphone_call_set_conf_ref(call->toC(), toC());
......
......@@ -736,7 +736,7 @@ void ServerGroupChatRoomPrivate::determineProtocolVersion(){
void ServerGroupChatRoomPrivate::addParticipantDevice (const shared_ptr<Participant> &participant, const shared_ptr<ParticipantDeviceIdentity> &deviceInfo) {
L_Q();
shared_ptr<ParticipantDevice> device = participant->findDevice(deviceInfo->getAddress());
shared_ptr<ParticipantDevice> device = participant->findDevice(deviceInfo->getAddress(), false);
if (device) {
// Nothing to do, but set the name and capabilities because they are not known for the initiator device.
......
......@@ -72,7 +72,7 @@ shared_ptr<CallSession> Participant::createSession (
// -----------------------------------------------------------------------------
shared_ptr<ParticipantDevice> Participant::addDevice (const IdentityAddress &gruu, const string &name) {
shared_ptr<ParticipantDevice> device = findDevice(gruu);
shared_ptr<ParticipantDevice> device = findDevice(gruu, false);
if (device)
return device;
device = ParticipantDevice::create(this, gruu, name);
......@@ -84,20 +84,25 @@ void Participant::clearDevices () {
devices.clear();
}
shared_ptr<ParticipantDevice> Participant::findDevice (const IdentityAddress &gruu) const {
shared_ptr<ParticipantDevice> Participant::findDevice (const IdentityAddress &gruu, const bool logFailure) const {
for (const auto &device : devices) {
if (device->getAddress() == gruu)
return device;
}
lInfo() << "Unable to find device with address " << gruu.asString();
if (logFailure) {
lInfo() << "Unable to find device with address " << gruu.asString();
}
return nullptr;
}
shared_ptr<ParticipantDevice> Participant::findDevice (const shared_ptr<const CallSession> &session) {
shared_ptr<ParticipantDevice> Participant::findDevice (const shared_ptr<const CallSession> &session, const bool logFailure) {
for (const auto &device : devices) {
if (device->getSession() == session)
return device;
}
if (logFailure) {
lInfo() << "Unable to find device with call session " << session;
}
return nullptr;
}
......
......@@ -90,8 +90,8 @@ public:
AbstractChatRoom::SecurityLevel getSecurityLevelExcept(const std::shared_ptr<ParticipantDevice> & ignoredDevice) const;
const std::list<std::shared_ptr<ParticipantDevice>> &getDevices () const;
std::shared_ptr<ParticipantDevice> findDevice (const IdentityAddress &gruu) const;
std::shared_ptr<ParticipantDevice> findDevice (const std::shared_ptr<const CallSession> &session);
std::shared_ptr<ParticipantDevice> findDevice (const IdentityAddress &gruu, const bool logFailure = true) const;
std::shared_ptr<ParticipantDevice> findDevice (const std::shared_ptr<const CallSession> &session, const bool logFailure = true);
inline void setAdmin (bool isAdmin) { this->isThisAdmin = isAdmin; }
bool isAdmin () const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment