Skip to content

Commit 21a1744

Browse files
authored
chore: Fix connections (#22445)
Signed-off-by: Michael Heinrichs <[email protected]>
1 parent 5a53848 commit 21a1744

File tree

2 files changed

+444
-0
lines changed

2 files changed

+444
-0
lines changed

platform-sdk/consensus-otter-tests/src/testFixtures/java/org/hiero/otter/fixtures/internal/AbstractNetwork.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ public void restoreBandwidthLimitsForAllConnections(@NonNull final Node node) {
629629
@Override
630630
public void restoreConnectivity() {
631631
networkPartitions.clear();
632+
connected.clear();
632633
latencyOverrides.clear();
633634
bandwidthOverrides.clear();
634635
updateConnections();
@@ -1213,15 +1214,19 @@ public Node receiver() {
12131214
*/
12141215
@Override
12151216
public void disconnect() {
1217+
log.info("Disconnecting connection from node {} to node {}", sender.selfId(), receiver.selfId());
12161218
connected.put(connectionKey, false);
1219+
updateConnections();
12171220
}
12181221

12191222
/**
12201223
* {@inheritDoc}
12211224
*/
12221225
@Override
12231226
public void connect() {
1227+
log.info("Connecting connection from node {} to node {}", sender.selfId(), receiver.selfId());
12241228
connected.put(connectionKey, true);
1229+
updateConnections();
12251230
}
12261231

12271232
/**
@@ -1237,6 +1242,7 @@ public boolean isConnected() {
12371242
*/
12381243
@Override
12391244
public void restoreConnectivity() {
1245+
log.info("Restoring connectivity from node {} to node {}", sender.selfId(), receiver.selfId());
12401246
connected.remove(connectionKey);
12411247
restoreLatency();
12421248
restoreBandwidthLimit();
@@ -1257,7 +1263,9 @@ public Duration latency() {
12571263
@Override
12581264
public void latency(@NonNull final Duration latency) {
12591265
requireNonNull(latency);
1266+
log.info("Setting latency from node {} to node {} to {}", sender.selfId(), receiver.selfId(), latency);
12601267
latencyOverrides.put(connectionKey, new LatencyOverride(latency, jitter()));
1268+
updateConnections();
12611269
}
12621270

12631271
/**
@@ -1275,15 +1283,19 @@ public Percentage jitter() {
12751283
@Override
12761284
public void jitter(@NonNull final Percentage jitter) {
12771285
requireNonNull(jitter);
1286+
log.info("Setting jitter from node {} to node {} to {}", sender.selfId(), receiver.selfId(), jitter);
12781287
latencyOverrides.put(connectionKey, new LatencyOverride(latency(), jitter));
1288+
updateConnections();
12791289
}
12801290

12811291
/**
12821292
* {@inheritDoc}
12831293
*/
12841294
@Override
12851295
public void restoreLatency() {
1296+
log.info("Restoring latency from node {} to node {}", sender.selfId(), receiver.selfId());
12861297
latencyOverrides.remove(connectionKey);
1298+
updateConnections();
12871299
}
12881300

12891301
/**
@@ -1301,15 +1313,23 @@ public BandwidthLimit bandwidthLimit() {
13011313
@Override
13021314
public void bandwidthLimit(@NonNull final BandwidthLimit bandwidthLimit) {
13031315
requireNonNull(bandwidthLimit);
1316+
log.info(
1317+
"Setting bandwidth limit from node {} to node {} to {}",
1318+
sender.selfId(),
1319+
receiver.selfId(),
1320+
bandwidthLimit);
13041321
bandwidthOverrides.put(connectionKey, bandwidthLimit);
1322+
updateConnections();
13051323
}
13061324

13071325
/**
13081326
* {@inheritDoc}
13091327
*/
13101328
@Override
13111329
public void restoreBandwidthLimit() {
1330+
log.info("Restoring bandwidth limit from node {} to node {}", sender.selfId(), receiver.selfId());
13121331
bandwidthOverrides.remove(connectionKey);
1332+
updateConnections();
13131333
}
13141334
}
13151335

0 commit comments

Comments
 (0)