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
This commit is contained in:
Michael Bayne
2009-07-10 06:30:41 +00:00
parent 266595e2a0
commit 95bae1dec8
@@ -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