| 1 | package Net::WebSocket::EVx; | ||||||||||||||
| 2 | 6 | ▶ | use strict; use warnings; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 3 | 6 | ▶ | use EV (); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 4 | 6 | ▶ | use Carp (); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 5 | 6 | ▶ | use XSLoader (); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | 6 | our $VERSION; | |||||||||||||
| 7 | 6 | ▶ | BEGIN { | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 8 | 6 | $VERSION = '0.22'; | |||||||||||||
| 9 | 6 | XSLoader::load(__PACKAGE__, $VERSION); | |||||||||||||
| 10 | } | ||||||||||||||
| 11 | 6 | ▶ | use constant { WS_FRAGMENTED_EOF => 0, WS_FRAGMENTED_ERROR => -1, WS_FRAGMENTED_DATA => 1, | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 12 | 6 | WS_RSV_NONE => 0, WS_RSV1_BIT => 0x04 }; | |||||||||||||
| 13 | 6 | ▶ | use Exporter 'import'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 14 | 6 | our @EXPORT = qw/WS_FRAGMENTED_EOF WS_FRAGMENTED_ERROR WS_FRAGMENTED_DATA WS_RSV_NONE WS_RSV1_BIT/; | |||||||||||||
| 15 | |||||||||||||||
| 16 | 82 | ▶ | sub new { | ||||||||||||
|
Subroutine
new: called CC=10 SCAR=23.0
Pod
documented
| |||||||||||||||
| 17 | 82 | my (undef, $self) = @_; | |||||||||||||
| 18 | 82 | ▶ | $self->{buffering} = 1 unless defined $self->{buffering}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 19 | 82 | ▶ | $self->{type} = 'server' unless defined $self->{type}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 20 | my $fd = defined $self->{fd} ? $self->{fd} | ||||||||||||||
| 21 | : defined $self->{fh} ? fileno($self->{fh}) | ||||||||||||||
| 22 | 82 | ▶ | : Carp::croak(q{Net::WebSocket::EVx: new() needs an open "fh" or a numeric "fd"}); | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 23 | 81 | ▶ | Carp::croak(q{Net::WebSocket::EVx: "fh" is not an open filehandle}) unless defined $fd; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 24 | 80 | ▶ | Carp::croak("Net::WebSocket::EVx: invalid file descriptor: $fd") unless $fd >= 0; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 25 | 79 | bless $self; # before init, so a failure below still gets a DESTROY | |||||||||||||
| 26 | 79 | _wslay_event_context_init($self, $fd, int($self->{type} eq 'server')); | |||||||||||||
| 27 | 79 | _wslay_event_config_set_no_buffering($self, int(!$self->{buffering})); | |||||||||||||
| 28 | 79 | ▶ | _wslay_event_config_set_max_recv_msg_length($self, $self->{max_recv_size}) if defined $self->{max_recv_size}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 29 | 79 | ▶ | _wslay_event_config_set_allowed_rsv_bits($self, $self->{allowed_rsv}) if defined $self->{allowed_rsv}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 30 | 79 | ▶ | _set_default_rsv($self, $self->{rsv}) if defined $self->{rsv}; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 31 | 79 | $self | |||||||||||||
| 32 | } | ||||||||||||||
| 33 | |||||||||||||||
| 34 | 11 | ▶ | sub wait { if ($_[1]) { $_[0]->_set_waiter($_[1]) } } | ||||||||||||
|
Subroutine
wait: called CC=2 SCAR=7.2
Pod
documented
Branch: 1 branch
| |||||||||||||||
| 35 | |||||||||||||||
| 36 | 6 | 1; | |||||||||||||