@@ -68,7 +68,7 @@ public class ResumableDuplexConnection extends Flux<ByteBuf>
6868 public ResumableDuplexConnection (
6969 String tag , DuplexConnection initialConnection , ResumableFramesStore resumableFramesStore ) {
7070 this .tag = tag ;
71- this .onConnectionClosedSink = Sinks .many ().unsafe ().unicast ().onBackpressureBuffer ();
71+ this .onConnectionClosedSink = Sinks .unsafe ().many ().unicast ().onBackpressureBuffer ();
7272 this .resumableFramesStore = resumableFramesStore ;
7373 this .savableFramesSender = new UnboundedProcessor ();
7474 this .framesSaverDisposable = resumableFramesStore .saveFrames (savableFramesSender ).subscribe ();
@@ -114,7 +114,10 @@ void initConnection(DuplexConnection nextConnection) {
114114 __ -> {
115115 frameReceivingSubscriber .dispose ();
116116 disposable .dispose ();
117- onConnectionClosedSink .emitNext (currentConnectionIndex );
117+ Sinks .Emission emission = onConnectionClosedSink .tryEmitNext (currentConnectionIndex );
118+ if (emission .equals (Sinks .Emission .OK )) {
119+ logger .error ("Failed to notify session of closed connection: {}" , emission );
120+ }
118121 })
119122 .subscribe ();
120123 }
@@ -160,13 +163,13 @@ public void sendErrorAndClose(RSocketErrorException rSocketErrorException) {
160163 t -> {
161164 framesSaverDisposable .dispose ();
162165 savableFramesSender .dispose ();
163- onConnectionClosedSink .emitComplete ();
166+ onConnectionClosedSink .tryEmitComplete ();
164167 onClose .onError (t );
165168 },
166169 () -> {
167170 framesSaverDisposable .dispose ();
168171 savableFramesSender .dispose ();
169- onConnectionClosedSink .emitComplete ();
172+ onConnectionClosedSink .tryEmitComplete ();
170173 final Throwable cause = rSocketErrorException .getCause ();
171174 if (cause == null ) {
172175 onClose .onComplete ();
@@ -206,7 +209,7 @@ public void dispose() {
206209 framesSaverDisposable .dispose ();
207210 activeReceivingSubscriber .dispose ();
208211 savableFramesSender .dispose ();
209- onConnectionClosedSink .emitComplete ();
212+ onConnectionClosedSink .tryEmitComplete ();
210213 onClose .onComplete ();
211214 }
212215
0 commit comments