Skip to content

Commit ca4387e

Browse files
author
OlegDokuka
committed
fixes
Signed-off-by: Oleh Dokuka <[email protected]> Signed-off-by: Oleh Dokuka <[email protected]> Signed-off-by: OlegDokuka <[email protected]>
1 parent 9fe4ea1 commit ca4387e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

rsocket-core/src/main/java/io/rsocket/resume/ClientRSocketSession.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ void tryReestablishSession(Tuple2<ByteBuf, DuplexConnection> tuple2) {
329329
}
330330

331331
nextDuplexConnection.dispose();
332+
nextDuplexConnection.receive().subscribe();
332333
throw exception; // assume retryable exception
333334
} else {
334335
if (logger.isDebugEnabled()) {

rsocket-core/src/main/java/io/rsocket/resume/ResumableDuplexConnection.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ public boolean connect(DuplexConnection nextConnection) {
9696
if (activeConnection != DisposedConnection.INSTANCE
9797
&& ACTIVE_CONNECTION.compareAndSet(this, activeConnection, nextConnection)) {
9898

99-
activeConnection.dispose();
99+
if (!activeConnection.isDisposed()) {
100+
activeConnection.sendErrorAndClose(
101+
new ConnectionErrorException("Connection unexpectedly replaced"));
102+
}
100103

101104
initConnection(nextConnection);
102105

@@ -163,7 +166,7 @@ void initConnection(DuplexConnection nextConnection) {
163166

164167
public void disconnect() {
165168
final DuplexConnection activeConnection = this.activeConnection;
166-
if (activeConnection != DisposedConnection.INSTANCE) {
169+
if (activeConnection != DisposedConnection.INSTANCE && !activeConnection.isDisposed()) {
167170
activeConnection.dispose();
168171
}
169172
}

0 commit comments

Comments
 (0)