mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
Fixed event bug
This commit is contained in:
@@ -40,7 +40,7 @@ public class NetworkingClientManager implements org.toop.framework.networking.in
|
||||
networkingClient.connect(id, host, port);
|
||||
networkClients.put(id, networkingClient);
|
||||
logger.info("New client started successfully for {}:{}", host, port);
|
||||
new EventFlow().addPostEvent(new NetworkEvents.StartClientResponse(id, id)).postEvent();
|
||||
new EventFlow().addPostEvent(new NetworkEvents.StartClientResponse(id, false, id)).postEvent();
|
||||
scheduler.shutdown();
|
||||
} catch (CouldNotConnectException e) {
|
||||
attempts++;
|
||||
@@ -50,11 +50,12 @@ public class NetworkingClientManager implements org.toop.framework.networking.in
|
||||
scheduler.schedule(this, networkingReconnect.timeout(), networkingReconnect.timeUnit());
|
||||
} else {
|
||||
logger.error("Failed to start client for {}:{} after {} attempts", host, port, attempts);
|
||||
new EventFlow().addPostEvent(new NetworkEvents.StartClientResponse(-1, id)).postEvent();
|
||||
new EventFlow().addPostEvent(new NetworkEvents.StartClientResponse(-1, false, id)).postEvent();
|
||||
scheduler.shutdown();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Unexpected exception during startClient", e);
|
||||
new EventFlow().addPostEvent(new NetworkEvents.StartClientResponse(-1, false, id)).postEvent();
|
||||
scheduler.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,10 +134,11 @@ public class NetworkEvents extends EventsBase {
|
||||
* Response confirming a client was started.
|
||||
*
|
||||
* @param clientId The client ID assigned to the new connection.
|
||||
* @param successful If successfully connected or not. If not clientId will also be -1.
|
||||
* @param identifier Event ID used for correlation.
|
||||
*/
|
||||
@AutoResponseResult
|
||||
public record StartClientResponse(long clientId, long identifier) implements ResponseToUniqueEvent {}
|
||||
public record StartClientResponse(long clientId, boolean successful, long identifier) implements ResponseToUniqueEvent {}
|
||||
|
||||
/** WIP (Not working) Request to reconnect a client to a previous address. */
|
||||
public record Reconnect(long clientId, NetworkingReconnect networkingReconnect, long identifier)
|
||||
|
||||
Reference in New Issue
Block a user