UPnP:Controlpoint.pm change request

Begonnen von KölnSolar, 21 Februar 2021, 10:25:49

Vorheriges Thema - Nächstes Thema

KölnSolar

Hallo Reinerlein,
wie ich Dir bereits per PM signalisiert habe, arbeite ich intensiv an einer Neustrukturierung von FHEM-Modulen bzgl. perlupnp.

U.a. möchte ich für unsägliche freezes Abhilfe schaffen. Ich hab zwar noch nicht die konkreten Ursachen gefunden, wenigstens aber Einflussmöglichkeiten zur Verkürzung.

Du hast in Controlpoint.pm den Ursprung sub _createDevice {
my $self = shift;
my $location = shift;
my $device;

# We've found examples of where devices claim to do transfer
# encoding, but wind up sending chunks without chunk size headers.
# This code temporarily disables the TE header in the request.
push(@LWP::Protocol::http::EXTRA_SOCK_OPTS, SendTE => 0);
my $ua = LWP::UserAgent->new;
my $response = $ua->get($location);

my $base;
if ($response->is_success) {
($device, $base) = $self->parseDeviceDescription($response->content,
  {Location => $location},
  {ControlPoint => $self});
}
else {
carp("Loading device description failed with error: " .
$response->code . " " . $response->message);
}
pop(@LWP::Protocol::http::EXTRA_SOCK_OPTS);


zu sub _createDevice {
my $self = shift;
my $location = shift;
my $device;

# We've found examples of where devices claim to do transfer
# encoding, but wind up sending chunks without chunk size headers.
# This code temporarily disables the TE header in the request.
#push(@LWP::Protocol::http::EXTRA_SOCK_OPTS, SendTE => 0);
my @SOCK_OPTS_Backup = @LWP::Protocol::http::EXTRA_SOCK_OPTS;
_addSendTE();
my $ua = LWP::UserAgent->new(timeout => 20);
my $response = $ua->get($location);
my $base;
if ($response->is_success && $response->content ne '') {
($device, $base) = $self->parseDeviceDescription($response->content,
  {Location => $location},
  {ControlPoint => $self});
} else {
carp('400-URL-Absolute-Error! Location: "'.$location.'", Content: "'.$response->content.'"') if ($response->code == 400);
carp("Loading device description failed with error: " . $response->code . " " . $response->message . ' (Location: ' . $location . ')') if ($response->code != 200);
}
#pop(@LWP::Protocol::http::EXTRA_SOCK_OPTS);
@LWP::Protocol::http::EXTRA_SOCK_OPTS = @SOCK_OPTS_Backup;


verändert.

Gibt es einen Grund für den timeout=20s (außer dass das wenigstens besser als der noch viel größere default in LWP ist) ?
Ich fände 2s genügen, ansonsten hat die Installation, doch ganz andere performance-Probleme. Das würde mir,Testern.... die Fehlersuche u. Modulentwicklung einiges erleichtern.

Oder direkt das Argument MaxWait des Controlpoints "missbrauchen"(wird bisher ja nur beim search benutzt) ? :-\

Grüße
Markus


RPi3/2 buster/stretch-SamsungAV_E/N-RFXTRX-IT-RSL-NC5462-Oregon-CUL433-GT-TMBBQ-01e-CUL868-FS20-EMGZ-1W(GPIO)-DS18B20-CO2-USBRS232-USBRS422-Betty_Boop-EchoDot-OBIS(Easymeter-Q3/EMH-KW8)-PCA301(S'duino)-Deebot(mqtt2)-zigbee2mqtt

KölnSolar

nach 2 Monaten ärgern über unendlich lange freezes hake ich nochmal nach. ::)

Bis dahin können alle freeze-Geplagten in der /FHEM/lib/UPnP ihre Controlpoint.pm modifizieren. Sucht nach new(timeoutund ersetzt die folgende Zahl nach Geschmack.
Mir genügt 20 --> 2 und 5 --> 1.
Grüße Markus
RPi3/2 buster/stretch-SamsungAV_E/N-RFXTRX-IT-RSL-NC5462-Oregon-CUL433-GT-TMBBQ-01e-CUL868-FS20-EMGZ-1W(GPIO)-DS18B20-CO2-USBRS232-USBRS422-Betty_Boop-EchoDot-OBIS(Easymeter-Q3/EMH-KW8)-PCA301(S'duino)-Deebot(mqtt2)-zigbee2mqtt