Code cleanup

This commit is contained in:
Andrea Cavalli 2022-03-04 01:28:18 +01:00
parent 090a47ae86
commit 26b9de5eb0

View File

@ -77,7 +77,8 @@ public class QuicUtils {
.in() .in()
.withConnection(conn -> conn.addHandler(recvCodec.get())) .withConnection(conn -> conn.addHandler(recvCodec.get()))
.receiveObject() .receiveObject()
.log("RECEIVE_OBJECT_FROM_SERVER", Level.FINEST)) .log("ClientBoundEvent", Level.FINEST)
)
.publish(1) .publish(1)
.refCount(); .refCount();
return new MappedStream<>(stream.out, sendCodec, inConn, streamTerminator); return new MappedStream<>(stream.out, sendCodec, inConn, streamTerminator);
@ -97,14 +98,13 @@ public class QuicUtils {
return QuicUtils return QuicUtils
.createMappedStream(quicConnection, sendCodec, recvCodec) .createMappedStream(quicConnection, sendCodec, recvCodec)
.flatMap(stream -> { .flatMap(stream -> {
var recv = stream.receive().log("SR-Receive", Level.FINEST); var recv = stream.receive().log("ClientBoundEvent", Level.FINEST);
var send = stream.send(req).log("SR-Send", Level.FINEST); var send = stream.send(req).log("ServerBoundEvent", Level.FINEST);
return send return send
.then(recv) .then(recv)
.doFinally(s -> stream.close()); .doFinally(s -> stream.close());
}) })
.switchIfEmpty((Mono<RECV>) NO_RESPONSE_ERROR) .switchIfEmpty((Mono<RECV>) NO_RESPONSE_ERROR);
.log("SR-Result", Level.FINEST);
} }
/** /**
@ -119,17 +119,17 @@ public class QuicUtils {
.flatMapMany(stream -> { .flatMapMany(stream -> {
var sends = Flux var sends = Flux
.from(requestFlux) .from(requestFlux)
.log("SR-Send", Level.FINEST) .log("ServerBoundEvent", Level.FINEST)
.concatMap(request -> stream.send(request) .concatMap(request -> stream.send(request)
.thenReturn(request)); .thenReturn(request));
var receives = stream var receives = stream
.receiveMany() .receiveMany()
.log("SR-Receive", Level.FINEST); .log("ClientBoundEvent", Level.FINEST);
return Flux return Flux
.zip(sends, receives, QuicUtils::extractResponse) .zip(sends, receives, QuicUtils::extractResponse)
.doFinally(s -> stream.close()); .doFinally(s -> stream.close());
}) })
.log("SR-Result", Level.FINEST); .log("ServerBoundEvent", Level.FINEST);
} }
/** /**