Run hook_reset_transaction after all connections
This makes hook_reset_transaction a bit more useful by running it on disconnections. It also ensures that hook_disconnect runs when the client disconnects without QUITing.
This commit is contained in:
parent
96aa5ba171
commit
5c3bd220aa
@ -576,6 +576,7 @@ sub quit_respond {
|
||||
sub disconnect {
|
||||
my $self = shift;
|
||||
$self->run_hooks("disconnect");
|
||||
$self->connection->notes(disconnected => 1);
|
||||
$self->reset_transaction;
|
||||
}
|
||||
|
||||
|
@ -115,6 +115,10 @@ sub read_input {
|
||||
alarm $timeout;
|
||||
}
|
||||
alarm(0);
|
||||
return if $self->connection->notes('disconnected');
|
||||
$self->reset_transaction;
|
||||
$self->run_hooks('disconnect');
|
||||
$self->connection->notes(disconnected => 1);
|
||||
}
|
||||
|
||||
sub respond {
|
||||
|
@ -35,6 +35,11 @@ sub read_input {
|
||||
or $self->respond(502, "command unrecognized: '$_'");
|
||||
alarm $timeout;
|
||||
}
|
||||
unless ($self->connection->notes('disconnected')) {
|
||||
$self->reset_transaction;
|
||||
$self->run_hooks('disconnect');
|
||||
$self->connection->notes(disconnected => 1);
|
||||
}
|
||||
};
|
||||
if ($@ =~ /^disconnect_tcpserver/) {
|
||||
die "disconnect_tcpserver";
|
||||
|
Loading…
Reference in New Issue
Block a user