remove sync modifier from getConnectionState and tidy
This commit is contained in:
parent
f2b2fc769f
commit
94ca2a04e6
1 changed files with 6 additions and 5 deletions
|
@ -31,11 +31,12 @@ public abstract class RpcSystem<VatId> {
|
||||||
getConnectionState(connection);
|
getConnectionState(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized RpcState getConnectionState(VatNetwork.Connection connection) {
|
RpcState getConnectionState(VatNetwork.Connection connection) {
|
||||||
|
|
||||||
var onDisconnect = new CompletableFuture<VatNetwork.Connection>().thenAccept(lostConnection -> {
|
var onDisconnect = new CompletableFuture<VatNetwork.Connection>()
|
||||||
this.connections.remove(lostConnection);
|
.thenAccept(lostConnection -> {
|
||||||
});
|
this.connections.remove(lostConnection);
|
||||||
|
});
|
||||||
|
|
||||||
return connections.computeIfAbsent(connection, key ->
|
return connections.computeIfAbsent(connection, key ->
|
||||||
new RpcState(bootstrapInterface, connection, onDisconnect));
|
new RpcState(bootstrapInterface, connection, onDisconnect));
|
||||||
|
@ -50,7 +51,7 @@ public abstract class RpcSystem<VatId> {
|
||||||
|
|
||||||
private CompletableFuture<java.lang.Void> doMessageLoop() {
|
private CompletableFuture<java.lang.Void> doMessageLoop() {
|
||||||
var accept = this.getAcceptLoop();
|
var accept = this.getAcceptLoop();
|
||||||
for (var conn : connections.values()) {
|
for (var conn: this.connections.values()) {
|
||||||
accept = accept.acceptEither(conn.getMessageLoop(), x -> {});
|
accept = accept.acceptEither(conn.getMessageLoop(), x -> {});
|
||||||
}
|
}
|
||||||
return accept.thenCompose(x -> this.doMessageLoop());
|
return accept.thenCompose(x -> this.doMessageLoop());
|
||||||
|
|
Loading…
Reference in a new issue