Skip to content

Commit 2b09eeb

Browse files
author
Rob Harrop
committed
Be careful of potential livelock here
1 parent 0a98bd8 commit 2b09eeb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,13 @@ public ConfirmListener getConfirmListener() {
162162
public boolean waitForConfirms()
163163
throws InterruptedException
164164
{
165+
long seqHead = this.getNextPublishSeqNo();
165166
synchronized (unconfirmedSet) {
166167
while (true) {
167168
if (getCloseReason() != null) {
168169
throw Utility.fixStackTrace(getCloseReason());
169170
}
170-
if (unconfirmedSet.isEmpty()) {
171+
if (unconfirmedSet.headSet(seqHead).isEmpty()) {
171172
boolean aux = onlyAcksReceived;
172173
onlyAcksReceived = true;
173174
return aux;

0 commit comments

Comments
 (0)