Add disconnect() to Connection, using the CLS protocol command
Signed-off-by: Pedro Melo <melo@simplicidade.org>
This commit is contained in:
@@ -85,6 +85,21 @@ sub connect {
|
||||
return;
|
||||
}
|
||||
|
||||
sub disconnect {
|
||||
my ($self, $cb) = @_;
|
||||
return unless my $hdl = $self->{handle};
|
||||
|
||||
$hdl->push_write("CLS\012");
|
||||
|
||||
$self->_on_next_success_frame(
|
||||
sub {
|
||||
$cb->($self, @_) if $cb;
|
||||
$self->_force_disconnect;
|
||||
}
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
## Protocol API
|
||||
|
||||
|
||||
Reference in New Issue
Block a user