-
Notifications
You must be signed in to change notification settings - Fork 108
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
Add timeout options #207
Add timeout options #207
Conversation
The client discards handshake response messages that take too long to receive because a long delay prevents accurate synchronization between the client and vehicle clocks. However, the client still considered the handshake complete after receiving a delayed response. Vehicles send unsolicited handshake response messages when they detect a desychronization, and so the StartSession method relied on this automatic detection without verifying the result. This commit fixes the issue by having the client check that a session was successfully established and retrying as needed.
} | ||
select { | ||
case <-time.After(d.conn.RetryInterval()): | ||
case <-ctx.Done(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for not doing a sleep
case d.outbox <- responseBytes: | ||
return | ||
default: | ||
panic(errOutboxFull) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we accept the test context and t.Fatal
instead of panic
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(1) Can't call t.Fatal
from a goroutine (https://pkg.go.dev/testing#B.FailNow); (2) This is called by a stubbed interface implementation, so t
can't be passed in the method call, and storing t
in structs is, if I recall correctly, Not Recommended.
Both of these issues could be addressed by adding in some plumbing and sending fatal errors through channels, but this doesn't seem worthwhile.
Timeouts were previously hard-coded. This change allows clients to specify timeouts dynamically.
Adds timeout command-line options that override the defaults.
de089b5
to
dd3584d
Compare
Description
Fixes an issue where a handshake would incorrectly be marked as completed if the response came in after the timeout expired.
Adds API and CLI options for adjusting timeouts.
Fixes #194
Type of change
Please select all options that apply to this change:
Checklist:
Confirm you have completed the following steps: