104
|
0 |
2 |
0 |
$$self{"${type}_stream_id"} ||= $self->ioloop->client('address', $self->_gateway_address, 'port', $port, 'tls', 1, 'tls_cert', $self->cert, 'tls_key', $self->key, $self->insecure ? ('tls_verify', 0) : (), sub {
my($ioloop, $err, $stream) = @_;
return $self->emit('error', "${type}: $err") if $err;
$stream->on('close', sub {
delete $$self{"${type}_stream_id"};
}
);
$stream->on('error', sub {
$self->emit('error', "${type}: $_[1]");
}
);
$stream->on('drain', sub {
$self->emit('drain');
}
);
$stream->on('timeout', sub {
delete $$self{"${type}_stream_id"};
}
);
$self->$cb($stream);
}
) |