Set isConnected, isBound, implCreated on server-side LocalSockets
Previously LocalServerSocket.accept() would return a LocalSocket instance with isConnected, isBound and implCreated set to false. [implCreated determines whether impl.create() needs to called]. A socket created via accept() in this way is implicitly bound and connected. impl.create() does not need to be called because impl.accept(LocalSocketImpl s) is called instead and has the same effect (s.fd and s.mFdCreatedInternally set correctly). This change modifies the behavior so that the flags are now all set to true in this case and isBound() and isConnected() will now return the correct answer. Attempts to call bind() and connect() will still throw IOException as before, but with a different exception message. Correctly setting implCreated in LocalSocket means that LocalSocketImpl.create() will no longer be called for accept() created sockets and no longer needs to treat the "fd != null" case as a no-op: we can now assert that there must be no fd set when create() is called as we will no longer call it with sockets created using accept(). Bug: https://code.google.com/p/android/issues/detail?id=35942 Test: Device boot Test: vogar --mode app_process cts/tests/tests/net/src/android/net/cts/LocalServerSocketTest.java Test: vogar --mode app_process cts/tests/tests/net/src/android/net/cts/LocalSocketTest.java Change-Id: I3ac55439412e84501ae7c5ae6c9976e03b2d6fc5
Loading
Please register or sign in to comment