Skip to content

Commit 6e1ce0b

Browse files
author
Hubert Plociniczak
committed
Always reply to Channel.Close message from the server
1 parent fac60a6 commit 6e1ce0b

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/com/rabbitmq/client/impl/ChannelN.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,22 @@ public void releaseChannelNumber() {
168168
// incoming commands except for a close-ok.
169169

170170
Method method = command.getMethod();
171+
172+
if (method instanceof Channel.Close) {
173+
// Channel should always respond to Channel.Close
174+
// from the server
175+
releaseChannelNumber();
176+
ShutdownSignalException signal = new ShutdownSignalException(false,
177+
false,
178+
command,
179+
this);
180+
synchronized(this) {
181+
processShutdownSignal(signal);
182+
quiescingTransmit(new Channel.CloseOk());
183+
}
184+
notifyListeners();
185+
return true;
186+
}
171187
if (isOpen()) {
172188
// We're in normal running mode.
173189

@@ -215,18 +231,6 @@ public void releaseChannelNumber() {
215231
}
216232
}
217233
return true;
218-
} else if (method instanceof Channel.Close) {
219-
releaseChannelNumber();
220-
ShutdownSignalException signal = new ShutdownSignalException(false,
221-
false,
222-
command,
223-
this);
224-
synchronized(this) {
225-
processShutdownSignal(signal);
226-
quiescingTransmit(new Channel.CloseOk());
227-
}
228-
notifyListeners();
229-
return true;
230234
} else {
231235
return false;
232236
}

0 commit comments

Comments
 (0)