Bugfixes in SSDP Device and Discovery
This commit is contained in:
parent
e44becfa23
commit
ccc70650f2
@ -47,7 +47,11 @@ class Device
|
|||||||
|
|
||||||
public static function createFromSchema($url, $ip)
|
public static function createFromSchema($url, $ip)
|
||||||
{
|
{
|
||||||
$xml = simplexml_load_file($url);
|
$xml = @simplexml_load_file($url);
|
||||||
|
if (empty($xml)) {
|
||||||
|
error_log("Unable to retrieve UPnP schema from {$url}");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$spec = $xml->children('urn:schemas-upnp-org:device-1-0');
|
$spec = $xml->children('urn:schemas-upnp-org:device-1-0');
|
||||||
if (count($spec)>0) {
|
if (count($spec)>0) {
|
||||||
|
@ -47,8 +47,12 @@ class Discovery implements IteratorAggregate
|
|||||||
foreach ($responses as $response) {
|
foreach ($responses as $response) {
|
||||||
// Add the relevant responses to the list
|
// Add the relevant responses to the list
|
||||||
if ($response instanceof MSearchResponse) {
|
if ($response instanceof MSearchResponse) {
|
||||||
|
$loc = $response->getLocation();
|
||||||
|
if (array_key_exists($loc, $this->devices)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$device = Device::createFromSchema($response->getLocation(), $response->getIp());
|
$device = Device::createFromSchema($response->getLocation(), $response->getIp());
|
||||||
$this->devices[] = $device;
|
$this->devices[$loc] = $device;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user