[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:
parent
011b1f15c2
commit
e5591ce2fa
1 changed files with 811 additions and 28 deletions
|
|
@ -16,6 +16,9 @@
|
|||
|
||||
package android.net;
|
||||
|
||||
import static android.net.SocketKeepalive.ERROR_INVALID_IP_ADDRESS;
|
||||
import static android.net.SocketKeepalive.ERROR_INVALID_PORT;
|
||||
|
||||
import android.net.SocketKeepalive.InvalidPacketException;
|
||||
import android.net.util.IpUtils;
|
||||
import android.system.OsConstants;
|
||||
|
|
@ -44,11 +47,11 @@ public final class NattKeepalivePacketData extends KeepalivePacketData {
|
|||
throws InvalidPacketException {
|
||||
|
||||
if (!(srcAddress instanceof Inet4Address) || !(dstAddress instanceof Inet4Address)) {
|
||||
throw new InvalidPacketException(SocketKeepalive.ERROR_INVALID_IP_ADDRESS);
|
||||
throw new InvalidPacketException(ERROR_INVALID_IP_ADDRESS);
|
||||
}
|
||||
|
||||
if (dstPort != NattSocketKeepalive.NATT_PORT) {
|
||||
throw new InvalidPacketException(SocketKeepalive.ERROR_INVALID_PORT);
|
||||
throw new InvalidPacketException(ERROR_INVALID_PORT);
|
||||
}
|
||||
|
||||
int length = IPV4_HEADER_LENGTH + UDP_HEADER_LENGTH + 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue