Skip to content

Commit b703480

Browse files
committed
Close Connection on Cancel
The Router event stream is an odd kind of connection that needs to be completely closed by the client when consumption is finished. This change updates the operation to explicitly close the connection when canceled. It doesn't handle the Future part of closing, so this is almost certainly insufficient for the long term.
1 parent b5fad07 commit b703480

File tree

1 file changed

+1
-1
lines changed
  • cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/routing/v1/tcproutes

1 file changed

+1
-1
lines changed

cloudfoundry-client-reactor/src/main/java/org/cloudfoundry/reactor/routing/v1/tcproutes/ReactorTcpRoutes.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public Mono<Void> delete(DeleteTcpRoutesRequest request) {
6666
@Override
6767
public Flux<TcpRouteEvent> events(EventsRequest request) {
6868
return get(builder -> builder.pathSegment("routing", "v1", "tcp_routes", "events"))
69-
.flatMap(inbound -> inbound.addHandler(new EventStreamDecoderChannelHandler()).receiveObject())
69+
.flatMap(inbound -> inbound.addHandler(new EventStreamDecoderChannelHandler()).receiveObject().doOnCancel(() -> inbound.channel().close())) // TODO: No way this is the proper way to close.
7070
.cast(ServerSentEvent.class)
7171
.map(event -> {
7272
try {

0 commit comments

Comments
 (0)