diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2020-04-18 10:16:14 +0000 |
---|---|---|
committer | Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> | 2020-04-18 10:16:14 +0000 |
commit | e7fc183ea8472c5599cf21b0d82b5e91479c6861 (patch) | |
tree | d58fc4f84c87aa2fb231d92486457d1b5c7cde52 | |
parent | 873b22e76a73c49e9a31479f3735458e96dca6fc (diff) | |
parent | 0c9452d2baea6544d2af61bd95a1d1cb1e712ac4 (diff) |
Merge "Make IpClientIntegrationTest pass on rvc-dev." into rvc-dev am: 5d74a29e95 am: 0c9452d2ba
Change-Id: If7c722637b7efe1944eafe5a47161a64408ade00
-rw-r--r-- | tests/integration/src/android/net/ip/IpClientIntegrationTest.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/integration/src/android/net/ip/IpClientIntegrationTest.java b/tests/integration/src/android/net/ip/IpClientIntegrationTest.java index 56ad6c1..fdeddca 100644 --- a/tests/integration/src/android/net/ip/IpClientIntegrationTest.java +++ b/tests/integration/src/android/net/ip/IpClientIntegrationTest.java @@ -407,7 +407,13 @@ public class IpClientIntegrationTest { mPacketReaderThread.start(); mHandler = mPacketReaderThread.getThreadHandler(); - mTapFd = iface.getFileDescriptor().getFileDescriptor(); + // Detach the FileDescriptor from the ParcelFileDescriptor. + // Otherwise, the garbage collector might call the ParcelFileDescriptor's finalizer, which + // closes the FileDescriptor and destroys our tap interface. An alternative would be to + // make the ParcelFileDescriptor or the TestNetworkInterface a class member so they never + // go out of scope. + mTapFd = new FileDescriptor(); + mTapFd.setInt$(iface.getFileDescriptor().detachFd()); mPacketReader = new TapPacketReader(mHandler, mTapFd, DATA_BUFFER_LEN); mHandler.post(() -> mPacketReader.start()); } |