@Override public void close(FileDescriptor fd) throws ErrnoException { try { if (S_ISSOCK(Libcore.os.fstat(fd).st_mode)) { if (isLingerSocket(fd)) { // If the fd is a socket with SO_LINGER set, we might block indefinitely. // We allow non-linger sockets so that apps can close their network // connections in methods like onDestroy which will run on the UI thread. BlockGuard.getThreadPolicy().onNetwork(); } untagSocket(fd); } } catch (ErrnoException ignored) { // We're called via Socket.close (which doesn't ask for us to be called), so we // must not throw here, because Socket.close must not throw if asked to close an // already-closed socket. Also, the passed-in FileDescriptor isn't necessarily // a socket at all. } os.close(fd); }
@Override public void close(FileDescriptor fd) throws ErrnoException { try { if (S_ISSOCK(Libcore.os.fstat(fd).st_mode)) { if (isLingerSocket(fd)) { // If the fd is a socket with SO_LINGER set, we might block indefinitely. // We allow non-linger sockets so that apps can close their network // connections in methods like onDestroy which will run on the UI thread. BlockGuard.getThreadPolicy().onNetwork(); } untagSocket(fd); } } catch (ErrnoException ignored) { // We're called via Socket.close (which doesn't ask for us to be called), so we // must not throw here, because Socket.close must not throw if asked to close an // already-closed socket. Also, the passed-in FileDescriptor isn't necessarily // a socket at all. } os.close(fd); }
@Override public FileDescriptor socket(int domain, int type, int protocol) throws ErrnoException { return tagSocket(os.socket(domain, type, protocol)); }
@Override public void close(FileDescriptor fd) throws ErrnoException { try { if (S_ISSOCK(Libcore.os.fstat(fd).st_mode)) { if (isLingerSocket(fd)) { // If the fd is a socket with SO_LINGER set, we might block indefinitely. // We allow non-linger sockets so that apps can close their network // connections in methods like onDestroy which will run on the UI thread. BlockGuard.getThreadPolicy().onNetwork(); } untagSocket(fd); } } catch (ErrnoException ignored) { // We're called via Socket.close (which doesn't ask for us to be called), so we // must not throw here, because Socket.close must not throw if asked to close an // already-closed socket. Also, the passed-in FileDescriptor isn't necessarily // a socket at all. } os.close(fd); }
@Override public FileDescriptor accept(FileDescriptor fd, InetSocketAddress peerAddress) throws ErrnoException, SocketException { BlockGuard.getThreadPolicy().onNetwork(); return tagSocket(os.accept(fd, peerAddress)); }
@Override public void close(FileDescriptor fd) throws ErrnoException { try { if (S_ISSOCK(Libcore.os.fstat(fd).st_mode)) { if (isLingerSocket(fd)) { // If the fd is a socket with SO_LINGER set, we might block indefinitely. // We allow non-linger sockets so that apps can close their network // connections in methods like onDestroy which will run on the UI thread. BlockGuard.getThreadPolicy().onNetwork(); } untagSocket(fd); } } catch (ErrnoException ignored) { // We're called via Socket.close (which doesn't ask for us to be called), so we // must not throw here, because Socket.close must not throw if asked to close an // already-closed socket. Also, the passed-in FileDescriptor isn't necessarily // a socket at all. } os.close(fd); }
@Override public void close(FileDescriptor fd) throws ErrnoException { try { if (S_ISSOCK(Libcore.os.fstat(fd).st_mode)) { if (isLingerSocket(fd)) { // If the fd is a socket with SO_LINGER set, we might block indefinitely. // We allow non-linger sockets so that apps can close their network // connections in methods like onDestroy which will run on the UI thread. BlockGuard.getThreadPolicy().onNetwork(); } untagSocket(fd); } } catch (ErrnoException ignored) { // We're called via Socket.close (which doesn't ask for us to be called), so we // must not throw here, because Socket.close must not throw if asked to close an // already-closed socket. Also, the passed-in FileDescriptor isn't necessarily // a socket at all. } os.close(fd); }
@Override public void close(FileDescriptor fd) throws ErrnoException { try { if (S_ISSOCK(Libcore.os.fstat(fd).st_mode)) { if (isLingerSocket(fd)) { // If the fd is a socket with SO_LINGER set, we might block indefinitely. // We allow non-linger sockets so that apps can close their network // connections in methods like onDestroy which will run on the UI thread. BlockGuard.getThreadPolicy().onNetwork(); } untagSocket(fd); } } catch (ErrnoException ignored) { // We're called via Socket.close (which doesn't ask for us to be called), so we // must not throw here, because Socket.close must not throw if asked to close an // already-closed socket. Also, the passed-in FileDescriptor isn't necessarily // a socket at all. } os.close(fd); }
@Override public void close(FileDescriptor fd) throws ErrnoException { try { if (S_ISSOCK(Libcore.os.fstat(fd).st_mode)) { if (isLingerSocket(fd)) { // If the fd is a socket with SO_LINGER set, we might block indefinitely. // We allow non-linger sockets so that apps can close their network // connections in methods like onDestroy which will run on the UI thread. BlockGuard.getThreadPolicy().onNetwork(); } untagSocket(fd); } } catch (ErrnoException ignored) { // We're called via Socket.close (which doesn't ask for us to be called), so we // must not throw here, because Socket.close must not throw if asked to close an // already-closed socket. Also, the passed-in FileDescriptor isn't necessarily // a socket at all. } os.close(fd); }
@Override public FileDescriptor socket(int domain, int type, int protocol) throws ErrnoException { return tagSocket(os.socket(domain, type, protocol)); }
@Override public FileDescriptor socket(int domain, int type, int protocol) throws ErrnoException { return tagSocket(os.socket(domain, type, protocol)); }
@Override public FileDescriptor socket(int domain, int type, int protocol) throws ErrnoException { return tagSocket(os.socket(domain, type, protocol)); }
@Override public FileDescriptor socket(int domain, int type, int protocol) throws ErrnoException { return tagSocket(os.socket(domain, type, protocol)); }