Skip to content

Commit 61fd3d8

Browse files
committed
working on a bug.
1 parent 02aa801 commit 61fd3d8

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/main/java/net/sharksystem/asap/engine/ASAPEngine.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private void newEra(boolean force, int nextEra) {
132132
Log.writeLog(this, this.toString(), "era not forced - incremented era to " + nextEra);
133133
}
134134
try {
135-
int oldEra = this.era;
135+
int previousEra = this.era;
136136

137137
// we are done here - we are in a new era.
138138
this.era = nextEra;
@@ -141,25 +141,24 @@ private void newEra(boolean force, int nextEra) {
141141
if(this.memento != null) this.memento.save(this);
142142

143143
/* now:
144-
oldEra .. era that was used a few milliseconds before. Keep it.
144+
previousEra .. era that was used a few milliseconds before. Keep it.
145145
this.era .. era we are going to work with
146146
147147
Now, there could be a very old version with same number as this.era - remove it before you set up
148148
fresh era
149149
*/
150150

151-
if(this.era == oldEra) {
152-
Log.writeLog(this, this.toString(), "this.era == oldEra - nothing to do");
151+
if(this.era == previousEra) {
152+
Log.writeLog(this, this.toString(), "this.era == previousEra - nothing to do");
153153
} else {
154-
Log.writeLog(this, this.toString(), "old era is going to be overwritten: " + this.era);
155-
// drop very very old chunks - if available
154+
// drop very very old chunks - if available - if not - don't care
156155
this.getChunkStorage().dropChunks(this.era);
157156

158157
Log.writeLog(this, this.toString(),
159158
"setup new era by cloning previous chunk meta data: "
160-
+ this.era + " | " + oldEra);
159+
+ this.era + " | " + previousEra);
161160
// setup new era - copy all chunks
162-
for(ASAPInternalChunk chunk : this.getChunkStorage().getChunks(oldEra)) {
161+
for(ASAPInternalChunk chunk : this.getChunkStorage().getChunks(previousEra)) {
163162
ASAPInternalChunk copyChunk = this.getChunkStorage().getChunk(chunk.getUri(), this.era);
164163
copyChunk.clone(chunk);
165164
}

src/test/java/net/sharksystem/asap/engine/MultihopTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,10 @@ public void asapRoutingIsFiniteAndCheckEra() throws IOException, ASAPException,
419419
System.out.println("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
420420
alicePeer.startEncounter(TestHelper.getPortNumber(), claraPeer);
421421
// give your app a moment to process
422-
Thread.sleep(1000);
422+
Thread.sleep(500);
423423
alicePeer.stopEncounter(claraPeer);
424-
Thread.sleep(1000);
424+
Thread.sleep(500);
425+
//Thread.sleep(60*1000);
425426
Assert.assertEquals(1, claraListener.numberOfMessages);
426427

427428
// Alice:1->2 new connection after new data added to channel.

0 commit comments

Comments
 (0)