Skip to content

Commit 5291c6c

Browse files
author
Tim Watson
committed
Differentiate between handling channel id allocation and maintaining state
1 parent 003c17a commit 5291c6c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

projects/client/RabbitMQ.Client/src/util/IntAllocator.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public class IntAllocator{
6262
* A class representing a list of inclusive intervals
6363
*/
6464
public class IntervalList{
65-
public IntervalList(int start, int end){
65+
public IntervalList(int start, int end) {
6666
this.Start = start;
6767
this.End = end;
6868
}
@@ -154,8 +154,9 @@ public int Allocate()
154154
if(unsortedCount > 0){
155155
return unsorted[--unsortedCount];
156156
} else if (Base != null) {
157-
int result = Base.Start++;
158-
if(Base.Start > Base.End) Base = Base.Next;
157+
int result = Base.Start;
158+
if (Base.Start == Base.End) Base = Base.Next;
159+
else Base.Start++;
159160
return result;
160161
} else {
161162
return -1;

0 commit comments

Comments
 (0)