Skip to content
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

Move $nameserver from ExecutorInterface to UdpTransportExecutor #135

Merged
merged 1 commit into from
Jul 11, 2019

Conversation

clue
Copy link
Member

@clue clue commented Jul 11, 2019

This changeset removes the $nameserver argument from the ExecutorInterface and adds it as a constructor attribute to the UdpTransportExecutor. This allows for a significant clean up in our APIs as most of the existing implementations of ExecutorInterface do not care about the nameserver and simply pass it through to some underlying executor. This also allows for future optimizations (such as reusing a single socket for multiple lookups) and helps with future TCP/IP executors (#19) and also multiple DNS servers by implementing fallback strategies as a hierarchy of executors (#6). These APIs are somewhat internal and it's unlikely this will affect many consumers of this package.

// old
$executor = new UdpTransportExecutor($loop);
$promise = $executor->query($nameserver, $query);

// new
$executor = new UdpTransportExecutor($nameserver, $loop);
$promise = $executor->query($query);

Additionally, we can now validate the nameserver address and throw an InvalidArgumentException if it is invalid.

Refs #131
Refs #128

@clue clue added this to the v1.0.0 milestone Jul 11, 2019
@WyriHaximus WyriHaximus requested review from WyriHaximus and jsor July 11, 2019 09:03
@jsor jsor merged commit 9f5bf59 into reactphp:master Jul 11, 2019
@clue clue deleted the nameserver-interface branch July 11, 2019 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants