Skip to content

Commit 222d4ad

Browse files
committed
don't reduce requested if already Long.MAX_VALUE
1 parent 3b64e76 commit 222d4ad

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/rx/internal/operators/OnSubscribeRedo.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,10 +500,12 @@ void emit(long mreq, Producer mp, long mprod) {
500500
long u = requested + mreq;
501501
if (u < 0) {
502502
u = Long.MAX_VALUE;
503-
}
504-
u -= mprod;
505-
if (u < 0) {
506-
throw new IllegalStateException("More produced than requested");
503+
} else
504+
if (u != Long.MAX_VALUE) {
505+
u -= mprod;
506+
if (u < 0) {
507+
throw new IllegalStateException("More produced than requested");
508+
}
507509
}
508510
requested = u;
509511

0 commit comments

Comments
 (0)