diff options
author | Brad Fitzpatrick <bradfitz@android.com> | 2011-03-17 17:14:46 -0700 |
---|---|---|
committer | Brad Fitzpatrick <bradfitz@android.com> | 2011-03-17 17:14:46 -0700 |
commit | 4be4e69f0128b7d9b0a29651ef4b79d806ae3ce7 (patch) | |
tree | 7ea32b884c407264ff50b4b857e51b94a5fcf825 /include/sysutils/SocketClient.h | |
parent | 51101e86dce3c512a915308274406968aa5d0760 (diff) | |
download | system_core-4be4e69f0128b7d9b0a29651ef4b79d806ae3ce7.zip system_core-4be4e69f0128b7d9b0a29651ef4b79d806ae3ce7.tar.gz system_core-4be4e69f0128b7d9b0a29651ef4b79d806ae3ce7.tar.bz2 |
Fix potential race introduced in Icd7f5f03
Digit wrote:
"You probably don't want to close the socket here without updating
c->socket as well. Otherwise, another thread holding a handle to the
client after the c->decRef() could end up sending a message to a
different socket, if the file descriptor index is reused by another
client in the meantime."
Change-Id: Icdefb5ffc0c7607325d7db761e1f04e5d868bfb7
Diffstat (limited to 'include/sysutils/SocketClient.h')
-rw-r--r-- | include/sysutils/SocketClient.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/sysutils/SocketClient.h b/include/sysutils/SocketClient.h index ef6dd9b..d6bb7d5 100644 --- a/include/sysutils/SocketClient.h +++ b/include/sysutils/SocketClient.h @@ -44,7 +44,7 @@ public: // SocketListener creates a SocketClient (at refcount 1) and calls // decRef() when it's done with the client. void incRef(); - void decRef(); + bool decRef(); // returns true at 0 (but note: SocketClient already deleted) }; typedef android::List<SocketClient *> SocketClientCollection; |