Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions rsocket-core/src/main/java/io/rsocket/core/RSocketRequester.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2018 the original author or authors.
* Copyright 2015-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,7 @@
import static io.rsocket.keepalive.KeepAliveSupport.ClientKeepAliveSupport;

import io.netty.buffer.ByteBuf;
import io.netty.util.collection.IntObjectMap;
import io.rsocket.DuplexConnection;
import io.rsocket.Payload;
import io.rsocket.RSocket;
Expand Down Expand Up @@ -343,15 +344,15 @@ private void terminate(Throwable e) {
}

synchronized (this) {
activeStreams
.values()
.forEach(
receiver -> {
try {
receiver.handleError(e);
} catch (Throwable ignored) {
}
});
for (IntObjectMap.PrimitiveEntry<FrameHandler> entry : activeStreams.entries()) {
FrameHandler handler = entry.value();
if (handler != null) {
try {
handler.handleError(e);
} catch (Throwable ignored) {
}
}
}
}

if (e == CLOSED_CHANNEL_EXCEPTION) {
Expand Down
10 changes: 8 additions & 2 deletions rsocket-core/src/main/java/io/rsocket/core/RSocketResponder.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2015-2018 the original author or authors.
* Copyright 2015-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@
package io.rsocket.core;

import io.netty.buffer.ByteBuf;
import io.netty.util.collection.IntObjectMap;
import io.rsocket.DuplexConnection;
import io.rsocket.Payload;
import io.rsocket.RSocket;
Expand Down Expand Up @@ -183,7 +184,12 @@ final void doOnDispose() {
}

private synchronized void cleanUpSendingSubscriptions() {
activeStreams.values().forEach(FrameHandler::handleCancel);
for (IntObjectMap.PrimitiveEntry<FrameHandler> entry : activeStreams.entries()) {
FrameHandler handler = entry.value();
if (handler != null) {
handler.handleCancel();
}
}
activeStreams.clear();
}

Expand Down