health: stop spamming.
Though it is useful to log when the client is dead, it is too spammy when the framework is dead. Stop spamming. Test: pass Bug: 191548101 Change-Id: I43bef16b14300c3e435173ef2af9d8dd9dbfedb8
This commit is contained in:
parent
1b8be7166f
commit
975a600029
1 changed files with 3 additions and 4 deletions
|
@ -35,10 +35,9 @@ namespace health {
|
||||||
namespace V2_1 {
|
namespace V2_1 {
|
||||||
namespace implementation {
|
namespace implementation {
|
||||||
|
|
||||||
bool IsDeadObjectLogged(const Return<void>& ret) {
|
bool IsDeadObject(const Return<void>& ret) {
|
||||||
if (ret.isOk()) return false;
|
if (ret.isOk()) return false;
|
||||||
if (ret.isDeadObject()) return true;
|
if (ret.isDeadObject()) return true;
|
||||||
LOG(ERROR) << "Cannot call healthInfoChanged* on callback: " << ret.description();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +76,7 @@ Return<Result> BinderHealth::registerCallback(const sp<V2_0::IHealthInfoCallback
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto ret = wrapped->Notify(health_info);
|
auto ret = wrapped->Notify(health_info);
|
||||||
if (IsDeadObjectLogged(ret)) {
|
if (IsDeadObject(ret)) {
|
||||||
// Remove callback reference.
|
// Remove callback reference.
|
||||||
std::lock_guard<decltype(callbacks_lock_)> lock(callbacks_lock_);
|
std::lock_guard<decltype(callbacks_lock_)> lock(callbacks_lock_);
|
||||||
auto it = std::find_if(callbacks_.begin(), callbacks_.end(),
|
auto it = std::find_if(callbacks_.begin(), callbacks_.end(),
|
||||||
|
@ -133,7 +132,7 @@ void BinderHealth::OnHealthInfoChanged(const HealthInfo& health_info) {
|
||||||
std::unique_lock<decltype(callbacks_lock_)> lock(callbacks_lock_);
|
std::unique_lock<decltype(callbacks_lock_)> lock(callbacks_lock_);
|
||||||
for (auto it = callbacks_.begin(); it != callbacks_.end();) {
|
for (auto it = callbacks_.begin(); it != callbacks_.end();) {
|
||||||
auto ret = (*it)->Notify(health_info);
|
auto ret = (*it)->Notify(health_info);
|
||||||
if (IsDeadObjectLogged(ret)) {
|
if (IsDeadObject(ret)) {
|
||||||
it = callbacks_.erase(it);
|
it = callbacks_.erase(it);
|
||||||
} else {
|
} else {
|
||||||
++it;
|
++it;
|
||||||
|
|
Loading…
Reference in a new issue