-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd91fd5
commit f7e9cc5
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/network/p2pauction/NetworkTimerSF.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.network.p2pauction; | ||
|
||
public class NetworkTimerSF { | ||
private double delay; | ||
|
||
public void startTimer() { | ||
delay = 0.0; | ||
} | ||
|
||
public void waitForAck() { | ||
return; | ||
} | ||
|
||
public void updateDelayOnAckReceived(String s) { | ||
if(s.contains("initial")) | ||
delay += Math.random() * (0.0019 - 0.0013) + 0.0013; | ||
else | ||
delay += Math.random() * (0.0005 - 0.0003) + 0.0003; | ||
} | ||
public double getDelay() { | ||
return this.delay; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/network/p2pauction/NetworkTimerWOSF.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.network.p2pauction; | ||
|
||
public class NetworkTimerWOSF { | ||
private double delay; | ||
|
||
public void startTimer() { | ||
delay = 0.0; | ||
} | ||
|
||
public void waitForAck() { | ||
return; | ||
} | ||
|
||
public void updateDelayOnAckReceived(String s) { | ||
if(s.contains("leaderboard") || s.contains("position")) | ||
delay += Math.random() * (0.0019 - 0.0013 + 1) + 0.0013; | ||
else | ||
delay += Math.random() * (0.0005 - 0.0003 + 1) + 0.0003; | ||
} | ||
public double getDelay() { | ||
return this.delay; | ||
} | ||
} |