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:
@@ -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
|
// 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
|
// "leftover", so we pass it to the partial write handler
|
||||||
SocketChannel sochan = conn.getChannel();
|
SocketChannel sochan = conn.getChannel();
|
||||||
if (!sochan.isConnected()) {
|
if (sochan.isConnectionPending()) {
|
||||||
pwh.handlePartialWrite(conn, _outbuf);
|
pwh.handlePartialWrite(conn, _outbuf);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1130,8 +1130,8 @@ public class ConnectionManager extends LoopingThread
|
|||||||
if (_partial != null) {
|
if (_partial != null) {
|
||||||
// if our outgoing channel is still not ready, then bail immediately
|
// if our outgoing channel is still not ready, then bail immediately
|
||||||
SocketChannel sochan = conn.getChannel();
|
SocketChannel sochan = conn.getChannel();
|
||||||
if (sochan == null || !sochan.isConnected()) {
|
if (sochan == null || (!sochan.isConnected() && !sochan.isConnectionPending())) {
|
||||||
throw new IOException("Connection unavailable for overflow write");
|
throw new IOException("Connection unavailable for overflow write " + sochan);
|
||||||
}
|
}
|
||||||
|
|
||||||
// write all we can of our partial buffer
|
// write all we can of our partial buffer
|
||||||
|
|||||||
Reference in New Issue
Block a user