libsnapuserd: Handle empty response from server
If server disconnects, then handle the empty response. Bug: 377068272 Test: Full OTA Change-Id: Ic48204c457ef924ba9a3c1ae84a3317fb1ccda04 Signed-off-by: Akilesh Kailash <akailash@google.com>
This commit is contained in:
parent
a5560db8cc
commit
454167f5bd
1 changed files with 5 additions and 0 deletions
|
|
@ -311,6 +311,11 @@ double SnapuserdClient::GetMergePercent() {
|
|||
}
|
||||
std::string response = Receivemsg();
|
||||
|
||||
// If server socket disconnects most likely because of device reboot,
|
||||
// then we just return 0.
|
||||
if (response.empty()) {
|
||||
return 0.0;
|
||||
}
|
||||
return std::stod(response);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue