diff options
3 files changed, 12 insertions, 2 deletions
diff --git a/AndroidAsync/src/com/koushikdutta/async/AsyncServer.java b/AndroidAsync/src/com/koushikdutta/async/AsyncServer.java index cdfa8c9..6fb0336 100644 --- a/AndroidAsync/src/com/koushikdutta/async/AsyncServer.java +++ b/AndroidAsync/src/com/koushikdutta/async/AsyncServer.java @@ -18,6 +18,7 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.SocketAddress; import java.nio.ByteBuffer; +import java.nio.channels.CancelledKeyException; import java.nio.channels.ClosedChannelException; import java.nio.channels.ClosedSelectorException; import java.nio.channels.DatagramChannel; @@ -576,7 +577,7 @@ public class AsyncServer { } catch (Exception e) { Log.e(LOGTAG, "exception?", e); - } + } return; } @@ -764,6 +765,8 @@ public class AsyncServer { assert false; } } + catch (CancelledKeyException ex) { + } catch (Exception ex) { Log.e(LOGTAG, "inner loop exception", ex); } diff --git a/AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpClient.java b/AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpClient.java index f18adf9..37a8372 100644 --- a/AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpClient.java +++ b/AndroidAsync/src/com/koushikdutta/async/http/AsyncHttpClient.java @@ -93,8 +93,10 @@ public class AsyncHttpClient { if (!super.cancel()) return false; - if (socket != null) + if (socket != null) { + socket.setDataCallback(new NullDataCallback()); socket.close(); + } if (scheduled != null) mServer.removeAllCallbacks(scheduled); diff --git a/AndroidAsync/src/com/koushikdutta/async/util/HashList.java b/AndroidAsync/src/com/koushikdutta/async/util/HashList.java index 7ea19a8..9fd41b6 100644 --- a/AndroidAsync/src/com/koushikdutta/async/util/HashList.java +++ b/AndroidAsync/src/com/koushikdutta/async/util/HashList.java @@ -2,6 +2,7 @@ package com.koushikdutta.async.util; import java.util.ArrayList; import java.util.Hashtable; +import java.util.Set; /** * Created by koush on 5/27/13. @@ -15,6 +16,10 @@ public class HashList<T> { public HashList() { } + public Set<String> keySet() { + return internal.keySet(); + } + public synchronized <V> V tag(String key) { TaggedList<T> list = internal.get(key); if (list == null) |