From 12b10af67e4c70cc9cd0aaa3fce6b609a7726a31 Mon Sep 17 00:00:00 2001 From: rudolfkoenig Date: Sun, 6 Mar 2022 09:20:24 +0000 Subject: [PATCH] HttpUtils.pm: better error handling when conn is replaced (Forum #126593) git-svn-id: https://svn.fhem.de/fhem/trunk@25784 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/HttpUtils.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fhem/FHEM/HttpUtils.pm b/fhem/FHEM/HttpUtils.pm index e6fc0adc6..e83a6e717 100644 --- a/fhem/FHEM/HttpUtils.pm +++ b/fhem/FHEM/HttpUtils.pm @@ -509,6 +509,14 @@ HttpUtils_Connect2NonblockingSSL($$) "HttpUtils_TimeoutErr", \%timerHash); $hash->{directReadFn} = sub() { + if(!$hash->{conn}->can('connect_SSL')) { # 126593 + my $err = "HttpUtils_Connect2NonblockingSSL: connection handle in ". + "$hash->{NAME} was replaced, terminating connection"; + HttpUtils_Close($hash); + Log 1, $err; + return $hash->{callback}($hash, $err); + } + return if(!$hash->{conn}->connect_SSL() && $! == EWOULDBLOCK); RemoveInternalTimer(\%timerHash);