amphp / dns

Async DNS resolution for PHP based on Amp.
https://amphp.org/dns
MIT License
157 stars 32 forks source link

Optional setting is optional #6

Closed rdlowrey closed 10 years ago

rdlowrey commented 10 years ago

My life would be eased if it were possible to set the following options on Addr\Client after instantiation and not require them in the constructor:

Instances can function perfectly well with default values. More importantly, though, the Client class is generally going to be a dependency of other classes and so must be injected. By allowing at least $requestTimeout to be modified after instantiation the classes that are composed of Client instances can expose the option to modify DNS resolution timeouts.

I realize that clients currently open a UDP connection at instantiation time and hold that for the life of the object. As a result, allowing the address values to be modified would add some logic to the current code.

DaveRandom commented 10 years ago

Changing the server in use will be implemented as part of #4. I haven't worked out what the best way to do this would be yet, ideas are welcome.