[KA03] Support tcp keepalive offload

When offload is starting, socket will be switched to repair
mode. Read and write on the socket will not be allowed until
repair mode is turned off. If remote packet arrives, repair
mode will be turned off automatically and a callback will
be raised to indicate that socket is ready to read from.

Bug: 114151147
Test: -atest FrameworksNetTests
      -manual

Change-Id: I0c335865912e183e7ad32a8ea12188f02ccde5fd
This commit is contained in:
markchien 2018-12-27 22:49:51 +08:00 • committed by Chalard Jean
commit e5591ce2fa

View file

@ -109,15 +109,43 @@ public abstract class SocketKeepalive implements AutoCloseable {
**/
public static final int MAX_INTERVAL_SEC = 3600;
/**
* An exception that embarks an error code.
* @hide
*/
public static class ErrorCodeException extends Exception {
public final int error;
public ErrorCodeException(final int error, final Throwable e) {
super(e);
this.error = error;
}
public ErrorCodeException(final int error) {
this.error = error;
}
}
/**
* This socket is invalid.
* See the error code for details, and the optional cause.
* @hide
*/
public static class InvalidSocketException extends ErrorCodeException {
public InvalidSocketException(final int error, final Throwable e) {
super(error, e);
}
public InvalidSocketException(final int error) {
super(error);
}
}
/**
* This packet is invalid.
* See the error code for details.
* @hide
*/
public static class InvalidPacketException extends Exception {
public final int error;
public InvalidPacketException(int error) {
this.error = error;
public static class InvalidPacketException extends ErrorCodeException {
public InvalidPacketException(final int error) {
super(error);
}
}