diff options
author | Benoit Foucher <benoit@zeroc.com> | 2012-05-14 10:46:58 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2012-05-14 10:46:58 +0200 |
commit | baac62460df69a477c450b97735fd561350b4ccf (patch) | |
tree | 92ace9d048da2ff62a52819e6f01ead859a0032b /java/src/Ice/ConnectionI.java | |
parent | Also fixed property cloning for defaults properties (diff) | |
download | ice-baac62460df69a477c450b97735fd561350b4ccf.tar.bz2 ice-baac62460df69a477c450b97735fd561350b4ccf.tar.xz ice-baac62460df69a477c450b97735fd561350b4ccf.zip |
ICE-4750, Fixed connection assert
Diffstat (limited to 'java/src/Ice/ConnectionI.java')
-rw-r--r-- | java/src/Ice/ConnectionI.java | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java index 39199181845..0b0ffd4abb6 100644 --- a/java/src/Ice/ConnectionI.java +++ b/java/src/Ice/ConnectionI.java @@ -1058,16 +1058,20 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne { assert(_state <= StateClosing); - if((current.operation & IceInternal.SocketOperation.Write) != 0) - { - sentCBs = sendNextMessage(); - } - + // + // We parse messages first, if we receive a close + // connection message we won't send more messages. + // if((current.operation & IceInternal.SocketOperation.Read) != 0) { info = parseMessage(current.stream); // Optimization: use the thread's stream. } + if((current.operation & IceInternal.SocketOperation.Write) != 0) + { + sentCBs = sendNextMessage(); + } + // // We increment the dispatch count to prevent the // communicator destruction during the callback. @@ -1316,12 +1320,15 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne if(!_sendStreams.isEmpty()) { - // - // Return the stream to the outgoing call. This is important for - // retriable AMI calls which are not marshalled again. - // - OutgoingMessage message = _sendStreams.getFirst(); - _writeStream.swap(message.stream); + if(!_writeStream.isEmpty()) + { + // + // Return the stream to the outgoing call. This is important for + // retriable AMI calls which are not marshalled again. + // + OutgoingMessage message = _sendStreams.getFirst(); + _writeStream.swap(message.stream); + } // // NOTE: for twoway requests which are not sent, finished can be called twice: the @@ -1999,6 +2006,14 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne { break; } + + // + // If we are in the closed state, don't continue sending. + // + if(_state >= StateClosed) + { + break; + } // // Otherwise, prepare the next message stream for writing. |