TenKeyAngle / dataturbine

Automatically exported from code.google.com/p/dataturbine
1 stars 0 forks source link

Ping fails due to wrap around #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create new source in Java that calls source.VerifyConnection() multiple 
times (once per data point at 125hz or higher)
2. Observe a "Bad Ping response" message printed to the console between 4 to 8 
minutes

What is the expected output? What do you see instead?
The test in the isRunning method (see ACO.java line 1060) fails because 
pingValue wraps around after 4 minutes when calling VerifyConnection() multiple 
times during data collection.

What version of the product are you using? On what operating system?
3.2 latest release (Beta 6)

Possible work arounds:
1. Call VerifyConnection() less frequently by caching its results into a 
boolean variable and using this variable for your while loop check.
2. Avoid calling VerifyConnection() at all (not preferred)
3. Others?

Please provide any additional information below.
I suggest checking the value of pingValue to determine if a roll over has 
occurred. 

Original issue reported on code.google.com by RyanLind...@gmail.com on 9 Feb 2013 at 12:05

GoogleCodeExporter commented 9 years ago
Another solution would be to increment pingValue first before sending the Ping 
packet and then you can remove the pingValue-1 from the If statement. Java is 
probably casting the pingValue-1 result in the if statement into an integer 
primitive which makes the test show this: ping.getData() == 32767 with 
pingValue-1 == -32769 which doesn't equal each other.
If you implement the solution of incrementing the pingValue first before doing 
a send then there should be no casting up in the if statement since the 
pingValue-1 in the if statement can be changed to pingValue.

Original comment by RyanLind...@gmail.com on 9 Feb 2013 at 12:17