profile
viewpoint

Ask questionsAllow radius response to timeout

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.

layeh/radius

Answer questions bontibon

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.

This is only because context.Background() was used, no? Would have adding a sensible timeout to the context passed to the function solved this issue for you?

Second, the context setting is for the whole function call, and the response specific timeout is more granular.

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).

useful!

Related questions

No questions were found.
source:https://uonfu.com/
Github User Rank List