Overflowing int32 in RasConnection.GetConnectionStatistics().bytesTransmited/Received

May 18, 2010 at 2:48 PM
I'm not sure if the problem is the underling api calls, but the bytes overflow if the connection has transfered more than 2gb. Is there a way to work around or fix this?
Coordinator
May 18, 2010 at 4:29 PM

Well, the type being used in the interop is a DWORD so I can switch them to a uint. I'll just have to change the exposed type to a long to keep the assembly CLR compliant. For a workaround you can probably keep track of the total bytes yourself as you query the connection statistics, ensuring you clear the statistics everytime you call the method. That will keep the numbers below the threshold that'll cause the overflow.

I'll take a look at fixing it this evening for the 1.2 release. Thanks for reporting it!

Coordinator
May 18, 2010 at 4:33 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
May 18, 2010 at 4:45 PM
Thanks for the fast reply! :) I'm looking forward for your fix! Cheers!
Coordinator
May 19, 2010 at 4:47 AM

I'll have to take a look at it tomorrow, had some stuff come up I had to work on this evening that I couldn't get out of doing. I did a quick check in the code, and the implementation will not be difficult, just need to do some work in the structs and make some unit tests for overload protection.

Coordinator
May 20, 2010 at 9:17 PM

It took me a bit longer than I had hoped to get the changes made, but they have been completed. I've also added a number of unit tests to ensure this doesn't happen again in the future. Changeset 59047 or later is what you're looking for.