-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Added support for /etc/hosts #36
Conversation
This adds support for /etc/hosts through a HostsFileExecutor executor. The Factory is changed so that the Resolver looks in /etc/hosts first. The executor stack looks like this: CachedExecutor -> HostsFileExecutor -> RetryExecutor -> Executor.
Awesome work! However reading a file is blocking. I would suggest implementing one of the following changes:
|
will have a look at that. however that will introduce a new dependency? Not sure if that will be a problem. and resolve.conf has the same issue? |
Yeah...just checked out filesystem...no problem with the extra lib dependency but it requires the EIO extension...so I would suggest going with 1. resolve.conf would have the same issue, yeah |
@cboden this is what I understood from your comment. |
Actually, my recent work removed the dependency on it. Still fine tuning it, but it works without |
$this->loop = $loop; | ||
$this->executor = $executor; | ||
$this->path = $path; | ||
$this->hosts = $this->loadHosts(); |
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.
Just call $this->loadHosts()
👍 I'd love to see this feature in – however I'm not sure about the limitations imposed by the current implementation:
My personal vote would be: Do we really care if loading the file is blocking? The results will be kept in memory anyway, so perhaps we can make this an explicit choice so that the blocking calls can be performed before the loop runs? |
I'm +1 for having an initial load that is blocking before the loop gets going in order to get this expected behaviour in. We can refactor to make it pure async at a later point in time. |
@cboden that works for me 👍 |
When it will be done? |
@jaapio Thank you for filing this PR and sparking the discussion again! 👍 Given that this PR hasn't received an update in a while, we've implemented this feature as part of #75 which landed in the last release I believe this has been answered, so I'm closing this for now. Again, thank you for your contribution and keep it coming! 👍 |
This adds support for /etc/hosts through a HostsFileExecutor executor as requested in #10
The Factory is changed so that the Resolver looks in /etc/hosts first. The executor stack looks like this: CachedExecutor -> HostsFileExecutor -> RetryExecutor -> Executor.
Thanks to @arnaud-lb for creating the original PR reactphp/reactphp#225