-
Notifications
You must be signed in to change notification settings - Fork 37.7k
net: Consistently use GetTimeMicros() for inactivity checks #9606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Concept ACK. This is non-obvious, but I think it's the way to go for 0.14. Going forward, we really want to use a steady_clock for the net, so we'll need to rethink timing sources altogether. |
utACK
There too it helps to use a single timing function everywhere, as preparation. Also the separation between mock-able and nonmock-able time functions should ideally be made clearer. It's just weird and arbitrary, that |
As I understand it on a higher level we (should) have multiple times:
One step would be to consistently sort these out. Not based on the unit used (microseconds, milliseconds, seconds) but on the semantic. |
Technically this breaks qt's rpcconsole.cpp - it subtracts nLastSend/Recv/nTimeConnected from GetTime(), though I'm not sure it matters. Add this to the list of things we need to rethink bottom-up for 0.15, but this seems like a sufficient bugfix for 0.14. |
utACK modulo addressing Matt's comment about rpcconsole.cpp. |
This is repeating ourselves a lot. Why not... hey, let's add a function to do |
Added a fixup commit to address the bug in |
The use of mocktime in test logic means that comparisons between GetTime() and GetTimeMicros()/1000000 are unreliable since the former can use mocktime values while the latter always gets the system clock; this changes the networking code's inactivity checks to consistently use the system clock for inactivity comparisons. Also remove some hacks from setmocktime() that are no longer needed, now that we're using the system clock for nLastSend and nLastRecv.
utACK 33306c2 |
33306c2
to
99464bc
Compare
utACK 99464bc |
1 similar comment
utACK 99464bc |
99464bc net: Consistently use GetTimeMicros() for inactivity checks (Suhas Daftuar)
Fixes #9586
The use of mocktime in test logic means that comparisons between
GetTime() and GetTimeMicros()/1000000 are unreliable since the former
can use mocktime values while the latter always gets the system clock;
this changes the networking code's inactivity checks to consistently
use the system clock for inactivity comparisons.
Also remove some hacks from setmocktime() that are no longer needed,
now that we're using the system clock for nLastSend and nLastRecv.
Please tag for 0.14.
ping @theuni