Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
the feature is called non-blocking name resolution
  • Loading branch information
kraih committed Jan 14, 2017
1 parent ac15003 commit b863ad4
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/Mojo/IOLoop.pm
Expand Up @@ -304,7 +304,7 @@ For better scalability (epoll, kqueue) and to provide non-blocking name
resolution, SOCKS5 as well as TLS support, the optional modules L<EV> (4.0+),
L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and
L<IO::Socket::SSL> (1.94+) will be used automatically if possible. Individual
features can also be disabled with the C<MOJO_NO_NDN>, C<MOJO_NO_SOCKS> and
features can also be disabled with the C<MOJO_NO_NNR>, C<MOJO_NO_SOCKS> and
C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook/"REAL-TIME WEB"> for more.
Expand Down
10 changes: 5 additions & 5 deletions lib/Mojo/IOLoop/Client.pm
Expand Up @@ -10,10 +10,10 @@ use Scalar::Util 'weaken';
use Socket qw(IPPROTO_TCP SOCK_STREAM TCP_NODELAY);

# Non-blocking name resolution requires Net::DNS::Native
use constant HAS_NDN => $ENV{MOJO_NO_NDN}
use constant HAS_NNR => $ENV{MOJO_NO_NNR}
? 0
: eval 'use Net::DNS::Native 0.15 (); 1';
my $NDN = HAS_NDN ? Net::DNS::Native->new(pool => 5, extra_thread => 1) : undef;
my $NDN = HAS_NNR ? Net::DNS::Native->new(pool => 5, extra_thread => 1) : undef;

# SOCKS support requires IO::Socket::Socks
use constant HAS_SOCKS => $ENV{MOJO_NO_SOCKS}
Expand All @@ -24,7 +24,7 @@ use constant WRITE => HAS_SOCKS ? IO::Socket::Socks::SOCKS_WANT_WRITE() : 0;

has reactor => sub { Mojo::IOLoop->singleton->reactor };

our @EXPORT_OK = qw(HAS_NDN HAS_SOCKS);
our @EXPORT_OK = qw(HAS_NNR HAS_SOCKS);

sub DESTROY { shift->_cleanup }

Expand All @@ -41,7 +41,7 @@ sub connect {
$_ && s/[[\]]//g for @$args{qw(address socks_address)};
my $address = $args->{socks_address} || ($args->{address} ||= '127.0.0.1');
return $reactor->next_tick(sub { $self && $self->_connect($args) })
if !HAS_NDN || $args->{handle};
if !HAS_NNR || $args->{handle};

# Non-blocking name resolution
my $handle = $self->{dns} = $NDN->getaddrinfo($address, _port($args),
Expand Down Expand Up @@ -334,7 +334,7 @@ Path to the TLS key file.
L<Mojo::IOLoop::Client> implements the following constants, which can be
imported individually.
=head2 HAS_NDN
=head2 HAS_NNR
Non-blocking name resolution is supported with L<Net::DNS::Native>.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/Daemon.pm
Expand Up @@ -279,7 +279,7 @@ For better scalability (epoll, kqueue) and to provide non-blocking name
resolution, SOCKS5 as well as TLS support, the optional modules L<EV> (4.0+),
L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and
L<IO::Socket::SSL> (1.94+) will be used automatically if possible. Individual
features can also be disabled with the C<MOJO_NO_NDN>, C<MOJO_NO_SOCKS> and
features can also be disabled with the C<MOJO_NO_NNR>, C<MOJO_NO_SOCKS> and
C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/Hypnotoad.pm
Expand Up @@ -185,7 +185,7 @@ For better scalability (epoll, kqueue) and to provide non-blocking name
resolution, SOCKS5 as well as TLS support, the optional modules L<EV> (4.0+),
L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and
L<IO::Socket::SSL> (1.94+) will be used automatically if possible. Individual
features can also be disabled with the C<MOJO_NO_NDN>, C<MOJO_NO_SOCKS> and
features can also be disabled with the C<MOJO_NO_NNR>, C<MOJO_NO_SOCKS> and
C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/Morbo.pm
Expand Up @@ -116,7 +116,7 @@ For better scalability (epoll, kqueue) and to provide non-blocking name
resolution, SOCKS5 as well as TLS support, the optional modules L<EV> (4.0+),
L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and
L<IO::Socket::SSL> (1.94+) will be used automatically if possible. Individual
features can also be disabled with the C<MOJO_NO_NDN>, C<MOJO_NO_SOCKS> and
features can also be disabled with the C<MOJO_NO_NNR>, C<MOJO_NO_SOCKS> and
C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/Server/Prefork.pm
Expand Up @@ -234,7 +234,7 @@ For better scalability (epoll, kqueue) and to provide non-blocking name
resolution, SOCKS5 as well as TLS support, the optional modules L<EV> (4.0+),
L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and
L<IO::Socket::SSL> (1.84+) will be used automatically if possible. Individual
features can also be disabled with the C<MOJO_NO_NDN>, C<MOJO_NO_SOCKS> and
features can also be disabled with the C<MOJO_NO_NNR>, C<MOJO_NO_SOCKS> and
C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more.
Expand Down
2 changes: 1 addition & 1 deletion lib/Mojo/UserAgent.pm
Expand Up @@ -434,7 +434,7 @@ For better scalability (epoll, kqueue) and to provide non-blocking name
resolution, SOCKS5 as well as TLS support, the optional modules L<EV> (4.0+),
L<Net::DNS::Native> (0.15+), L<IO::Socket::Socks> (0.64+) and
L<IO::Socket::SSL> (1.94+) will be used automatically if possible. Individual
features can also be disabled with the C<MOJO_NO_NDN>, C<MOJO_NO_SOCKS> and
features can also be disabled with the C<MOJO_NO_NNR>, C<MOJO_NO_SOCKS> and
C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook/"USER AGENT"> for more.
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Command/version.pm
@@ -1,7 +1,7 @@
package Mojolicious::Command::version;
use Mojo::Base 'Mojolicious::Command';

use Mojo::IOLoop::Client qw(HAS_NDN HAS_SOCKS);
use Mojo::IOLoop::Client qw(HAS_NNR HAS_SOCKS);
use Mojo::IOLoop::TLS 'HAS_TLS';
use Mojolicious;

Expand All @@ -14,7 +14,7 @@ sub run {
my $ev = eval 'use Mojo::Reactor::EV; 1' ? $EV::VERSION : 'n/a';
my $socks = HAS_SOCKS ? $IO::Socket::Socks::VERSION : 'n/a';
my $tls = HAS_TLS ? $IO::Socket::SSL::VERSION : 'n/a';
my $ndn = HAS_NDN ? $Net::DNS::Native::VERSION : 'n/a';
my $ndn = HAS_NNR ? $Net::DNS::Native::VERSION : 'n/a';

print <<EOF;
CORE
Expand Down

0 comments on commit b863ad4

Please sign in to comment.