Skip to content

Commit

Permalink
Don't check can_open_socket() if the caller provides their own socket.
Browse files Browse the repository at this point in the history
  • Loading branch information
rcaputo committed Feb 4, 2021
1 parent 7b6b7e2 commit 0dd7d80
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/POE/Component/Client/Ping.pm
Expand Up @@ -83,7 +83,10 @@ sub spawn {
croak "$type requires an even number of parameters" if @_ % 2;
my %params = @_;

croak "$type requires root privilege" unless can_open_socket();
my $socket = delete $params{Socket};
croak "$type requires root privilege" unless (
defined $socket or can_open_socket()
);

my $alias = delete $params{Alias};
$alias = "pinger" unless defined $alias and length $alias;
Expand All @@ -92,7 +95,6 @@ sub spawn {
$timeout = 1 unless defined $timeout and $timeout >= 0;

my $onereply = delete $params{OneReply};
my $socket = delete $params{Socket};
my $parallelism = delete $params{Parallelism} || -1;
my $rcvbuf = delete $params{BufferSize};
my $always_decode = delete $params{AlwaysDecodeAddress};
Expand Down

0 comments on commit 0dd7d80

Please sign in to comment.