diff options
author | Florian Dold <florian.dold@gmail.com> | 2014-03-30 21:41:58 +0000 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2014-03-30 21:41:58 +0000 |
commit | 9f10abfdc35d8f189a8e0a77a389799ca6b7f9e5 (patch) | |
tree | 39d855abacebeaa45752e4abc5b4a660d2603d70 /src/main/java/org/gnunet/voting/BallotTool.java | |
parent | 1fbef203844b19f8141bddcba20a977de34b211e (diff) | |
download | gnunet-java-9f10abfdc35d8f189a8e0a77a389799ca6b7f9e5.tar.gz gnunet-java-9f10abfdc35d8f189a8e0a77a389799ca6b7f9e5.zip |
- fix election crypto
- multi-way elections
- high-level signature containers
- fix bug in mesh test case
- fix bug in Strings.java
- ivy repo
Diffstat (limited to 'src/main/java/org/gnunet/voting/BallotTool.java')
-rw-r--r-- | src/main/java/org/gnunet/voting/BallotTool.java | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/main/java/org/gnunet/voting/BallotTool.java b/src/main/java/org/gnunet/voting/BallotTool.java index d03e0ea..c65c361 100644 --- a/src/main/java/org/gnunet/voting/BallotTool.java +++ b/src/main/java/org/gnunet/voting/BallotTool.java | |||
@@ -146,9 +146,9 @@ public class BallotTool extends Program { | |||
146 | private Mesh mesh; | 146 | private Mesh mesh; |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * A tunnel to 'currentAuthority' or null. | 149 | * A channel to 'currentAuthority' or null. |
150 | */ | 150 | */ |
151 | private Mesh.Tunnel tunnel; | 151 | private Mesh.Channel channel; |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * The authority we are currently communicating with. | 154 | * The authority we are currently communicating with. |
@@ -156,7 +156,7 @@ public class BallotTool extends Program { | |||
156 | private PeerIdentity currentAuthority; | 156 | private PeerIdentity currentAuthority; |
157 | 157 | ||
158 | /** | 158 | /** |
159 | * Are we finished with communicating over the mesh tunnel and don't need to worry about | 159 | * Are we finished with communicating over the mesh channel and don't need to worry about |
160 | * disconnection? | 160 | * disconnection? |
161 | */ | 161 | */ |
162 | private boolean tunnelCommunicationFinished; | 162 | private boolean tunnelCommunicationFinished; |
@@ -165,11 +165,11 @@ public class BallotTool extends Program { | |||
165 | 165 | ||
166 | public class BallotTunnelEndHandler implements TunnelEndHandler { | 166 | public class BallotTunnelEndHandler implements TunnelEndHandler { |
167 | @Override | 167 | @Override |
168 | public void onTunnelEnd(final Mesh.Tunnel tunnel) { | 168 | public void onChannelEnd(final Mesh.Channel channel) { |
169 | // FIXME: just re-running 'doCommands' is a bit of a hack | 169 | // FIXME: just re-running 'doCommands' is a bit of a hack |
170 | BallotTool.this.tunnel = null; | 170 | BallotTool.this.channel = null; |
171 | if (!tunnelCommunicationFinished) { | 171 | if (!tunnelCommunicationFinished) { |
172 | logger.warn("mesh tunnel disconnected, but operation not finished"); | 172 | logger.warn("mesh channel disconnected, but operation not finished"); |
173 | Scheduler.addDelayed(tunnelReconnectBackoff, new Scheduler.Task() { | 173 | Scheduler.addDelayed(tunnelReconnectBackoff, new Scheduler.Task() { |
174 | @Override | 174 | @Override |
175 | public void run(Scheduler.RunContext ctx) { | 175 | public void run(Scheduler.RunContext ctx) { |
@@ -182,14 +182,14 @@ public class BallotTool extends Program { | |||
182 | } | 182 | } |
183 | 183 | ||
184 | /** | 184 | /** |
185 | * Destroy the tunnel to the authority as well | 185 | * Destroy the channel to the authority as well |
186 | * as the mesh handle. | 186 | * as the mesh handle. |
187 | */ | 187 | */ |
188 | private void endMesh() { | 188 | private void endMesh() { |
189 | tunnelCommunicationFinished = true; | 189 | tunnelCommunicationFinished = true; |
190 | if (null != tunnel) { | 190 | if (null != channel) { |
191 | tunnel.destroy(); | 191 | channel.destroy(); |
192 | tunnel = null; | 192 | channel = null; |
193 | } | 193 | } |
194 | if (null != mesh) { | 194 | if (null != mesh) { |
195 | mesh.destroy(); | 195 | mesh.destroy(); |
@@ -260,7 +260,7 @@ public class BallotTool extends Program { | |||
260 | public void visit(SubmitFailureMessage m) { | 260 | public void visit(SubmitFailureMessage m) { |
261 | System.out.println("vote not submitted: " + m.reason); | 261 | System.out.println("vote not submitted: " + m.reason); |
262 | if (m.signedAuthorityTime != null) { | 262 | if (m.signedAuthorityTime != null) { |
263 | // FIXME: verify | 263 | // FIXME: verifyRaw |
264 | System.out.println("authority time: " + | 264 | System.out.println("authority time: " + |
265 | AbsoluteTime.fromNetwork(m.signedAuthorityTime.time).toFancyString()); | 265 | AbsoluteTime.fromNetwork(m.signedAuthorityTime.time).toFancyString()); |
266 | } | 266 | } |
@@ -323,11 +323,11 @@ public class BallotTool extends Program { | |||
323 | currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); | 323 | currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); |
324 | System.out.println("registering ballot with authority " + currentAuthority.toString()); | 324 | System.out.println("registering ballot with authority " + currentAuthority.toString()); |
325 | mesh = new Mesh(getConfiguration(), new BallotTunnelEndHandler(), new BallotRegisterReceiver()); | 325 | mesh = new Mesh(getConfiguration(), new BallotTunnelEndHandler(), new BallotRegisterReceiver()); |
326 | tunnel = mesh.createTunnel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true); | 326 | channel = mesh.createTunnel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true); |
327 | BallotRegisterRequestMessage m = new BallotRegisterRequestMessage(); | 327 | BallotRegisterRequestMessage m = new BallotRegisterRequestMessage(); |
328 | CompressedConfig ccfg = new CompressedConfig(ballot.toConfiguration()); | 328 | CompressedConfig ccfg = new CompressedConfig(ballot.toConfiguration()); |
329 | m.compressedBallotConfig = ccfg.compressedData; | 329 | m.compressedBallotConfig = ccfg.compressedData; |
330 | tunnel.send(m); | 330 | channel.send(m); |
331 | return; | 331 | return; |
332 | } | 332 | } |
333 | if (issue) { | 333 | if (issue) { |
@@ -368,7 +368,7 @@ public class BallotTool extends Program { | |||
368 | System.out.println("submitting to authority " + authority.toString()); | 368 | System.out.println("submitting to authority " + authority.toString()); |
369 | currentAuthority = authority; | 369 | currentAuthority = authority; |
370 | mesh = new Mesh(cfg, new BallotTunnelEndHandler(), new SubmitReceiver()); | 370 | mesh = new Mesh(cfg, new BallotTunnelEndHandler(), new SubmitReceiver()); |
371 | tunnel = mesh.createTunnel(authority, TallyAuthorityDaemon.MESH_PORT, true, true, null); | 371 | channel = mesh.createTunnel(authority, TallyAuthorityDaemon.MESH_PORT, true, true, null); |
372 | SubmitMessage m = new SubmitMessage(); | 372 | SubmitMessage m = new SubmitMessage(); |
373 | if (ballot.voterPub == null) { | 373 | if (ballot.voterPub == null) { |
374 | throw new InvalidBallotException("no voter in ballot"); | 374 | throw new InvalidBallotException("no voter in ballot"); |
@@ -384,7 +384,7 @@ public class BallotTool extends Program { | |||
384 | throw new InvalidBallotException("no encrypted vote in ballot"); | 384 | throw new InvalidBallotException("no encrypted vote in ballot"); |
385 | } | 385 | } |
386 | m.encryptedVote = ballot.encryptedVote; | 386 | m.encryptedVote = ballot.encryptedVote; |
387 | tunnel.send(m); | 387 | channel.send(m); |
388 | return; | 388 | return; |
389 | } | 389 | } |
390 | if (verify) { | 390 | if (verify) { |
@@ -402,10 +402,10 @@ public class BallotTool extends Program { | |||
402 | currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); | 402 | currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); |
403 | System.out.println("querying authority " + currentAuthority.toString()); | 403 | System.out.println("querying authority " + currentAuthority.toString()); |
404 | mesh = new Mesh(cfg, new BallotTunnelEndHandler(), new QueryReceiver()); | 404 | mesh = new Mesh(cfg, new BallotTunnelEndHandler(), new QueryReceiver()); |
405 | tunnel = mesh.createTunnel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true, null); | 405 | channel = mesh.createTunnel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true, null); |
406 | ResultQueryMessage m = new ResultQueryMessage(); | 406 | ResultQueryMessage m = new ResultQueryMessage(); |
407 | m.ballotGuid = ballot.getBallotGuid(); | 407 | m.ballotGuid = ballot.getBallotGuid(); |
408 | tunnel.send(m); | 408 | channel.send(m); |
409 | return; | 409 | return; |
410 | } | 410 | } |
411 | if (requestKey) { | 411 | if (requestKey) { |
@@ -418,10 +418,10 @@ public class BallotTool extends Program { | |||
418 | currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); | 418 | currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); |
419 | System.out.println("asking authority for key " + currentAuthority.toString()); | 419 | System.out.println("asking authority for key " + currentAuthority.toString()); |
420 | mesh = new Mesh(cfg, new BallotTunnelEndHandler(), new PublicKeyReceiver()); | 420 | mesh = new Mesh(cfg, new BallotTunnelEndHandler(), new PublicKeyReceiver()); |
421 | tunnel = mesh.createTunnel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true, null); | 421 | channel = mesh.createTunnel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true, null); |
422 | KeyQueryMessage m = new KeyQueryMessage(); | 422 | KeyQueryMessage m = new KeyQueryMessage(); |
423 | m.ballotGuid = ballot.getBallotGuid(); | 423 | m.ballotGuid = ballot.getBallotGuid(); |
424 | tunnel.send(m); | 424 | channel.send(m); |
425 | return; | 425 | return; |
426 | } | 426 | } |
427 | setReturnValue(1); | 427 | setReturnValue(1); |