mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-02 06:08:53 +00:00
Handle broken pipe errors specifically
Since 9555d3a537
, a capture/encoding error
was sometimes logged on exit.
This commit is contained in:
parent
0e473eb005
commit
5c3626ed47
2 changed files with 8 additions and 0 deletions
|
@ -72,4 +72,8 @@ public final class IO {
|
||||||
Throwable cause = e.getCause();
|
Throwable cause = e.getCause();
|
||||||
return cause instanceof ErrnoException && ((ErrnoException) cause).errno == OsConstants.EPIPE;
|
return cause instanceof ErrnoException && ((ErrnoException) cause).errno == OsConstants.EPIPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isBrokenPipe(Exception e) {
|
||||||
|
return e instanceof IOException && isBrokenPipe((IOException) e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,6 +113,10 @@ public class SurfaceEncoder implements AsyncProcessor {
|
||||||
alive = !stopped.get() && !capture.isClosed();
|
alive = !stopped.get() && !capture.isClosed();
|
||||||
}
|
}
|
||||||
} catch (IllegalStateException | IllegalArgumentException | IOException e) {
|
} catch (IllegalStateException | IllegalArgumentException | IOException e) {
|
||||||
|
if (IO.isBrokenPipe(e)) {
|
||||||
|
// Do not retry on broken pipe, which is expected on close because the socket is closed by the client
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
Ln.e("Capture/encoding error: " + e.getClass().getName() + ": " + e.getMessage());
|
Ln.e("Capture/encoding error: " + e.getClass().getName() + ": " + e.getMessage());
|
||||||
if (!prepareRetry(size)) {
|
if (!prepareRetry(size)) {
|
||||||
throw e;
|
throw e;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue