Fixed inWork key calculation bug in MultiStaged

This commit is contained in:
armin 2018-04-28 20:14:52 +02:00
parent e209e5039c
commit dfdeb5e52c
4 changed files with 7 additions and 7 deletions

View file

@ -17,7 +17,7 @@
using namespace std; using namespace std;
#define BATCH_MAX 4096 #define BATCH_MAX 4096
#define WIN_SIZE 21 #define WIN_SIZE 16
int main() { int main() {
util::bytestr key("db53d9bbd1f3a83b094eeca7dd970bd85b492fa2"); util::bytestr key("db53d9bbd1f3a83b094eeca7dd970bd85b492fa2");

View file

@ -20,7 +20,7 @@ public class CnC {
public static final int MAX_BITS = 62; public static final int MAX_BITS = 62;
public static void main(String[] args) { public static void main(String[] args) {
KeyServer kts = KSFactory.build(54, 30, 15, TimeUnit.MINUTES, 0.62f); KeyServer kts = KSFactory.build(50, 26, 1, TimeUnit.MINUTES, 0.62f);
CommServer server = new CommServer(PORT, kts); CommServer server = new CommServer(PORT, kts);
try { try {
server.listen(); server.listen();

View file

@ -101,7 +101,7 @@ public class ClientWorker implements Runnable {
private void retrieveResult() { private void retrieveResult() {
try { try {
String[] result = in.readLine().split(" "); String[] result = in.readLine().split(" "); // TODO: null check for in.readLine()
KeyRange kr = new KeyRange(Long.parseLong(result[0], 16), Long.parseLong(result[1], 16)); KeyRange kr = new KeyRange(Long.parseLong(result[0], 16), Long.parseLong(result[1], 16));
synchronized (keyServer) { synchronized (keyServer) {

View file

@ -81,9 +81,9 @@ public class MultiStagedServer implements KeyServer {
keyRangeBuffer.setInWork(keyRange); keyRangeBuffer.setInWork(keyRange);
// strip out partition bits -> get subspace KeyRange only // strip out partition bits -> get subspace KeyRange only
long mask = ((long) 1 << subIndex) - 1; long mask = ((long) 1 << subIndex + 1) - 1;
// add leading bit // add leading bit
long lb = ((long) 1 << subIndex); long lb = ((long) 1 << subIndex + 1);
KeyRange secKR = KeyRange secKR =
new KeyRange(((keyRange.getStart() & mask) | lb), ((keyRange.getEnd() & mask) | lb)); new KeyRange(((keyRange.getStart() & mask) | lb), ((keyRange.getEnd() & mask) | lb));
@ -96,9 +96,9 @@ public class MultiStagedServer implements KeyServer {
keyRangeBuffer.setSearched(keyRange); keyRangeBuffer.setSearched(keyRange);
// strip out partition bits -> get subspace KeyRange only // strip out partition bits -> get subspace KeyRange only
long mask = ((long) 1 << subIndex) - 1; long mask = ((long) 1 << subIndex + 1) - 1;
// add leading bit // add leading bit
long lb = ((long) 1 << subIndex); long lb = ((long) 1 << subIndex + 1);
KeyRange secKR = KeyRange secKR =
new KeyRange(((keyRange.getStart() & mask) | lb), ((keyRange.getEnd() & mask) | lb)); new KeyRange(((keyRange.getStart() & mask) | lb), ((keyRange.getEnd() & mask) | lb));