From eb6d6cf22b5d1cb66de5052589432fd94725761e Mon Sep 17 00:00:00 2001 From: Andrea Cavalli <andrea@cavallium.it> Date: Thu, 9 Sep 2021 20:14:00 +0200 Subject: [PATCH] Fix --- .../server/AsyncTdMiddleEventBusServer.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/it/tdlight/tdlibsession/td/middle/server/AsyncTdMiddleEventBusServer.java b/src/main/java/it/tdlight/tdlibsession/td/middle/server/AsyncTdMiddleEventBusServer.java index c306f42..f8c58f2 100644 --- a/src/main/java/it/tdlight/tdlibsession/td/middle/server/AsyncTdMiddleEventBusServer.java +++ b/src/main/java/it/tdlight/tdlibsession/td/middle/server/AsyncTdMiddleEventBusServer.java @@ -105,12 +105,30 @@ public class AsyncTdMiddleEventBusServer extends AbstractVerticle { if (this.td.tryEmitValue(td).isFailure()) { throw new IllegalStateException("Failed to set td instance"); } - return onSuccessfulStartRequest(td, botAddress, botAlias, botId, local); + return new OnSuccessfulStartRequestInfo(td, botAddress, botAlias, botId, local); }) + .flatMap(r -> onSuccessfulStartRequest(r.td, r.botAddress, r.botAlias, r.botId, r.local)) .doOnSuccess(s -> logger.trace("Stated verticle")) ); } + private static class OnSuccessfulStartRequestInfo { + + public final AsyncTdDirectImpl td; + public final String botAddress; + public final String botAlias; + public final int botId; + public final boolean local; + + public OnSuccessfulStartRequestInfo(AsyncTdDirectImpl td, String botAddress, String botAlias, int botId, boolean local) { + this.td = td; + this.botAddress = botAddress; + this.botAlias = botAlias; + this.botId = botId; + this.local = local; + } + } + private Mono<Void> onSuccessfulStartRequest(AsyncTdDirectImpl td, String botAddress, String botAlias, int botId, boolean local) { return td .initialize()