Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -405,8 +405,11 @@ private void readOutgoingPackets(int session, FileInputStream input) {
private void writeIncomingPackets(int session, FileOutputStream output) {
try {
while (isCurrent(session)) {
byte[] packet = Mobile.read();
// Blocks until a packet arrives; polling read() with a 2ms sleep
// woke the CPU ~500 times a second and drained the battery.
byte[] packet = Mobile.readTimeout(1000);
if (packet == null || packet.length == 0) {
// readTimeout returns at once before the core is started.
Thread.sleep(2);
continue;
}
Expand Down