diff options
author | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-03-27 11:42:42 +0200 |
---|---|---|
committer | Kjetil Ørbekk <kjetil.orbekk@gmail.com> | 2012-03-27 11:42:42 +0200 |
commit | cd660183bad3757d12beb9c1e9c1afa1d0e03419 (patch) | |
tree | 71225618cd14c4885385db623d18c8774281c6e7 /same/src/main/java | |
parent | 242ad944762e17fd3636beb40237c870551a653a (diff) |
Fix state bug.0.3
Make sure to copy the state when creating a new master. Using the same
state instance on the master and client is a disaster.
Diffstat (limited to 'same/src/main/java')
-rw-r--r-- | same/src/main/java/com/orbekk/same/Client.java | 5 | ||||
-rw-r--r-- | same/src/main/java/com/orbekk/same/Master.java | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/same/src/main/java/com/orbekk/same/Client.java b/same/src/main/java/com/orbekk/same/Client.java index b210b6b..53d0ac8 100644 --- a/same/src/main/java/com/orbekk/same/Client.java +++ b/same/src/main/java/com/orbekk/same/Client.java @@ -103,7 +103,8 @@ public class Client { listener.stateChanged(state.getComponent(component)); } } else { - logger.warn("Ignoring update: {}", + logger.warn("Ignoring update: {) => {}", + state.getComponent(component), new State.Component(component, revision, data)); } } @@ -261,7 +262,7 @@ public class Client { } catch (CancellationException e) { } if (!currentMasterProposal.isCancelled() && result != null) { - masterController.enableMaster(state, result); + masterController.enableMaster(new State(state), result); } } diff --git a/same/src/main/java/com/orbekk/same/Master.java b/same/src/main/java/com/orbekk/same/Master.java index 529d729..6041cf1 100644 --- a/same/src/main/java/com/orbekk/same/Master.java +++ b/same/src/main/java/com/orbekk/same/Master.java @@ -13,7 +13,7 @@ public class Master { private String myUrl; State state; private Broadcaster broadcaster; - private volatile int masterId = 0; + private volatile int masterId = 1; public static Master create(ConnectionManager connections, Broadcaster broadcaster, String myUrl, String networkName) { |