Skip to content

Commit

Permalink
Avoid buf leak in TcpServerTests.retryStrategiesWhenServerFails by cl…
Browse files Browse the repository at this point in the history
…osing BOUNDARY in NettyOutbound.sendGroups
  • Loading branch information
pderop committed Sep 20, 2022
1 parent 62c4407 commit c47ba03
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -42,6 +42,7 @@
import reactor.core.publisher.Mono;

import static reactor.netty5.ReactorNetty.PREDICATE_GROUP_BOUNDARY;
import static reactor.netty5.ReactorNetty.PREDICATE_GROUP_FLUSH;

/**
* An outbound-traffic API delegating to an underlying {@link Channel}.
Expand Down Expand Up @@ -236,7 +237,13 @@ default NettyOutbound sendGroups(Publisher<? extends Publisher<? extends Buffer>
.concatMap(p -> Flux.<Buffer>from(p)
.concatWith(Mono.just(BOUNDARY.copy(0, BOUNDARY.readableBytes(), true))), 32)
.doFinally(sig -> BOUNDARY.close()),
ReactorNetty.PREDICATE_GROUP_FLUSH);
buf -> {
boolean flush = PREDICATE_GROUP_FLUSH.test(buf);
if (flush) {
buf.close();
}
return flush;
});
}

/**
Expand Down

0 comments on commit c47ba03

Please sign in to comment.