Skip to content

Commit

Permalink
Adjusted needed answers
Browse files Browse the repository at this point in the history
  • Loading branch information
tcrosado committed May 4, 2017
1 parent b2defe3 commit 90cd316
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pwmlib/src/main/java/pt/ulisboa/tecnico/sec/tg11/PwmLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@
import java.sql.Timestamp;
import java.util.concurrent.*;

import static java.lang.Math.floor;
import static java.lang.Math.round;

/**
* Created by trosado on 01/03/17.
*/
public class PwmLib {

private int REPLICAS;
private int NEEDEDANSWERS;
private Integer REPLICAS;
private double NEEDEDANSWERS;
private final String CLIENT_PUBLIC_KEY = "privatekey";

private static final String PATH_TO_KEYSTORE = "./src/main/resources/keystore.jks";
Expand Down Expand Up @@ -72,8 +75,9 @@ issued at the client side, until a close() function is called.
this._threadList = new ConcurrentHashMap<String, Thread>();
this._serverKey = new HashMap<String, Key>();
this.REPLICAS = getNumberServers();
this.NEEDEDANSWERS = ((2/3)*(REPLICAS-1))+1;

this.NEEDEDANSWERS = round((2.0/3.0)*(REPLICAS-1));
System.out.println("Detected "+REPLICAS+" servers.");
System.out.println("Needs "+(NEEDEDANSWERS+1)+" answers to succeed.");

for(int i=1;i<=REPLICAS;i++){
String serverName = "PWMServer"+i;
Expand Down

0 comments on commit 90cd316

Please sign in to comment.