From 95bae1dec815058315051cf16721f619f02a0017 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Fri, 10 Jul 2009 06:30:41 +0000 Subject: [PATCH] We need to distinguish between a connection that is still pending (which may be the case for an outgoing connection since we do our connection asynchronously) and a connection that is no longer connected because it once was open and now it's closed. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5855 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/presents/server/net/ConnectionManager.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/java/com/threerings/presents/server/net/ConnectionManager.java b/src/java/com/threerings/presents/server/net/ConnectionManager.java index 6aaf8cc9c..fa48aa3c7 100644 --- a/src/java/com/threerings/presents/server/net/ConnectionManager.java +++ b/src/java/com/threerings/presents/server/net/ConnectionManager.java @@ -754,7 +754,7 @@ public class ConnectionManager extends LoopingThread // if the connection to which we're writing is not yet ready, the whole message is // "leftover", so we pass it to the partial write handler SocketChannel sochan = conn.getChannel(); - if (!sochan.isConnected()) { + if (sochan.isConnectionPending()) { pwh.handlePartialWrite(conn, _outbuf); return false; } @@ -1130,8 +1130,8 @@ public class ConnectionManager extends LoopingThread if (_partial != null) { // if our outgoing channel is still not ready, then bail immediately SocketChannel sochan = conn.getChannel(); - if (sochan == null || !sochan.isConnected()) { - throw new IOException("Connection unavailable for overflow write"); + if (sochan == null || (!sochan.isConnected() && !sochan.isConnectionPending())) { + throw new IOException("Connection unavailable for overflow write " + sochan); } // write all we can of our partial buffer