HttpUtils.pm: set socket to nonbocking (Forum #100247)

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@19349 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-05-08 16:26:21 +00:00
parent 21eb126cf8
commit a4eaafcbda

View File

@ -592,9 +592,11 @@ HttpUtils_Connect2($)
delete($hash->{httpheader});
$hash->{NAME} = "" if(!defined($hash->{NAME}));
my %timerHash = (hash=>$hash, checkSTS=>$selectTimestamp, msg=>"write to");
$hash->{conn}->blocking(0);
$hash->{directReadFn} = sub() {
my $buf;
my $len = sysread($hash->{conn},$buf,65536);
return if(!defined($len) && $! == EWOULDBLOCK);
$hash->{buf} .= $buf if(defined($len) && $len > 0);
if(!defined($len) || $len <= 0 ||
HttpUtils_DataComplete($hash)) {