Log non-EPIPE I/O exceptions
On close, the client closes the socket. This wakes up socket blocking calls on the server-side, by throwing an exception. Since this exception is expected, it was not logged. However, other IOExceptions might occur, which must not be ignored. For that purpose, log only IOException when they are not caused by an EPIPE error.
This commit is contained in:
parent
439a1fd4ed
commit
f4e7085c34
2 changed files with 9 additions and 1 deletions
|
@ -48,4 +48,9 @@ public final class IO {
|
|||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public static boolean isBrokenPipe(IOException e) {
|
||||
Throwable cause = e.getCause();
|
||||
return cause instanceof ErrnoException && ((ErrnoException) cause).errno == OsConstants.EPIPE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,10 @@ public final class Server {
|
|||
}
|
||||
screenEncoder.streamScreen(device, videoStreamer);
|
||||
} catch (IOException e) {
|
||||
// this is expected on close
|
||||
// Broken pipe is expected on close, because the socket is closed by the client
|
||||
if (!IO.isBrokenPipe(e)) {
|
||||
Ln.e("Video encoding error", e);
|
||||
}
|
||||
} finally {
|
||||
Ln.d("Screen streaming stopped");
|
||||
initThread.interrupt();
|
||||
|
|
Loading…
Reference in a new issue