… | |
… | |
91 | |
91 | |
92 | =item fh => $filehandle [C<fh> or C<connect> MANDATORY] |
92 | =item fh => $filehandle [C<fh> or C<connect> MANDATORY] |
93 | |
93 | |
94 | The filehandle this L<AnyEvent::Handle> object will operate on. |
94 | The filehandle this L<AnyEvent::Handle> object will operate on. |
95 | NOTE: The filehandle will be set to non-blocking mode (using |
95 | NOTE: The filehandle will be set to non-blocking mode (using |
96 | C<AnyEvent::Util::fh_nonblocking>) by the constructor and needs to stay in |
96 | C<AnyEvent::fh_unblock>) by the constructor and needs to stay in |
97 | that mode. |
97 | that mode. |
98 | |
98 | |
99 | =item connect => [$host, $service] [C<fh> or C<connect> MANDATORY] |
99 | =item connect => [$host, $service] [C<fh> or C<connect> MANDATORY] |
100 | |
100 | |
101 | Try to connect to the specified host and service (port), using |
101 | Try to connect to the specified host and service (port), using |
… | |
… | |
611 | # with AnyEvent::Handle, do them a favour. |
611 | # with AnyEvent::Handle, do them a favour. |
612 | my $type = getsockopt $self->{fh}, Socket::SOL_SOCKET (), Socket::SO_TYPE (); |
612 | my $type = getsockopt $self->{fh}, Socket::SOL_SOCKET (), Socket::SO_TYPE (); |
613 | Carp::croak "AnyEvent::Handle: only stream sockets supported, anything else will NOT work!" |
613 | Carp::croak "AnyEvent::Handle: only stream sockets supported, anything else will NOT work!" |
614 | if Socket::SOCK_STREAM () != (unpack "I", $type) && defined $type; |
614 | if Socket::SOCK_STREAM () != (unpack "I", $type) && defined $type; |
615 | |
615 | |
616 | AnyEvent::Util::fh_nonblocking $self->{fh}, 1; |
616 | AnyEvent::fh_unblock $self->{fh}; |
617 | |
617 | |
618 | $self->{_activity} = |
618 | $self->{_activity} = |
619 | $self->{_ractivity} = |
619 | $self->{_ractivity} = |
620 | $self->{_wactivity} = AE::now; |
620 | $self->{_wactivity} = AE::now; |
621 | |
621 | |