THRIFT-3643 Perl SSL server crushes if a client disconnect without handshake

Client: Perl
Patch: Nobuaki Sukegawa

This closes #874
This commit is contained in:
Nobuaki Sukegawa 2016-02-19 00:38:10 +09:00
parent 19a3a2771a
commit b16a0a94fc

View File

@ -54,7 +54,9 @@ sub __close
{
my $self = shift;
my $sock = ($self->{handle}->handles())[0];
$sock->close(SSL_no_shutdown => 1);
if ($sock) {
$sock->close(SSL_no_shutdown => 1);
}
}
sub __recv
@ -63,8 +65,10 @@ sub __recv
my $sock = shift;
my $len = shift;
my $buf = undef;
if ($sock) {
sysread($sock, $buf, $len);
return $buf;
}
return $buf;
}
sub __send
@ -79,7 +83,7 @@ sub __wait
{
my $self = shift;
my $sock = ($self->{handle}->handles())[0];
if ($sock->pending() eq 0) {
if ($sock and $sock->pending() eq 0) {
return $self->SUPER::__wait();
}
return $sock;