diff options
author | Jose <jose@zeroc.com> | 2012-12-14 17:32:22 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2012-12-14 17:32:22 +0100 |
commit | 301cc174e4804045f66ce23b34bff84942db7a09 (patch) | |
tree | da51c05094cb3c379c9c4cb00cdf63e094568f1a /java/src/IceInternal/TcpTransceiver.java | |
parent | Fixed (ICE-4913) - Deprecate Ice::Stats (diff) | |
download | ice-301cc174e4804045f66ce23b34bff84942db7a09.tar.bz2 ice-301cc174e4804045f66ce23b34bff84942db7a09.tar.xz ice-301cc174e4804045f66ce23b34bff84942db7a09.zip |
Fixed (ICE-5114) - android library demo exceptions.
Diffstat (limited to 'java/src/IceInternal/TcpTransceiver.java')
-rw-r--r-- | java/src/IceInternal/TcpTransceiver.java | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/java/src/IceInternal/TcpTransceiver.java b/java/src/IceInternal/TcpTransceiver.java index 586433dd21e..e05df24c7d9 100644 --- a/java/src/IceInternal/TcpTransceiver.java +++ b/java/src/IceInternal/TcpTransceiver.java @@ -89,6 +89,16 @@ final class TcpTransceiver implements Transceiver public boolean write(Buffer buf) { + // + // We don't want write to be called on android main thread as this will cause + // NetworkOnMainThreadException to be thrown. If that is the android main thread + // we return false and this method will be later called from the thread pool. + // + if(Util.isAndroidMainThread(Thread.currentThread())) + { + return false; + } + final int size = buf.b.limit(); int packetSize = size - buf.b.position(); @@ -115,7 +125,7 @@ final class TcpTransceiver implements Transceiver else if(ret == 0) { // - // Writing would block, so we reset the limit (if necessary) and return true to indicate + // Writing would block, so we reset the limit (if necessary) and return false to indicate // that more data must be sent. // if(packetSize == _maxSendPacketSize) |