-
Notifications
You must be signed in to change notification settings - Fork 183
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
Allow radius response to timeout #78
Comments
This is already supported with context: ctx, done := context.WithTimeout(context.Background(), time.Second)
defer done()
resp, err := client.Exchange(ctx, req, server.Addr) |
I saw this option before I opened this issue. First, the current default is insensible, as it doesn't set any timeout which means it will block forever. This is a real problem for protocol such as UDP where no acknowledgement is promised. This caused a bug in my program and it was pretty hard to trace it. I think that to make the library more user friendly and require less internal knowledge of the library internals it would be better to set reasonable timeout and let the user optimise it if needed. Second, the context setting is for the whole function call, and the response specific timeout is more granular. |
For compatibility, I set the default client timeout to 0 (no timeout) it should be changed to a reasonable value. If there is some versioning scheme in use, the default should be changed in the next minor version (and probably mentioned in the changes of that version) |
This is only because
Is there a real-world scenario why such a granular setting would be required? (I would simply like to avoid making the API surface larger if it can be helped). |
I used a
Right now I have reason to believe it is enough, yet I think that just like retry count the timeout of web request should be set to some default and be tuned in case it is required. The real issue here is the missing default and, in my opition, it would be harder to enforce default value as context property. Following other libraries convention seems to me a good idea. |
Same default infinite read timeout bit our project as well. My mistake to assume a sensible default read timeout to be set by Attempted to set one myself by looking for standard deadline functions like
The client example in documentation also uses |
Enhancement: currently after RADIUS request is sent (via Client.Exchange()) the response to the requests blocks.
In order to allow the response to timeout, a ReadTimeout can be set on the connection.
The text was updated successfully, but these errors were encountered: