summaryrefslogtreecommitdiff
path: root/java/src/Ice/ConnectionI.java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2012-05-14 11:10:25 +0200
committerBenoit Foucher <benoit@zeroc.com>2012-05-14 11:10:25 +0200
commit4c0ad6c7ca272b6b7e6ed39027d1ecf576add6ab (patch)
tree99e91c0683685b3b626869b029418ada8003edbc /java/src/Ice/ConnectionI.java
parentC++ bug fixes; adding more Python tests (diff)
parentICE-4750, Fixed connection assert (diff)
downloadice-4c0ad6c7ca272b6b7e6ed39027d1ecf576add6ab.tar.bz2
ice-4c0ad6c7ca272b6b7e6ed39027d1ecf576add6ab.tar.xz
ice-4c0ad6c7ca272b6b7e6ed39027d1ecf576add6ab.zip
Merge remote-tracking branch 'origin/master' into encoding11
Conflicts: CHANGES cs/src/Ice/ConnectionI.cs
Diffstat (limited to 'java/src/Ice/ConnectionI.java')
-rw-r--r--java/src/Ice/ConnectionI.java37
1 files changed, 26 insertions, 11 deletions
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java
index c174deb5068..1feeb7b34e0 100644
--- a/java/src/Ice/ConnectionI.java
+++ b/java/src/Ice/ConnectionI.java
@@ -1044,16 +1044,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.
@@ -1302,12 +1306,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
@@ -1968,6 +1975,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.