mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-08 01:14:19 +00:00
dash_dhcp, fake_roku, plex: real ReusePort fix
git-svn-id: https://svn.fhem.de/fhem/trunk@12926 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
8a3409b58a
commit
554bdd6947
@ -77,7 +77,7 @@ dash_dhcp_startListener($)
|
|||||||
$hash->{PORT} = AttrVal($name, 'port', $hash->{PORT});
|
$hash->{PORT} = AttrVal($name, 'port', $hash->{PORT});
|
||||||
Log3 $name, 4, "$name: using port $hash->{PORT}";
|
Log3 $name, 4, "$name: using port $hash->{PORT}";
|
||||||
|
|
||||||
if( my $socket = IO::Socket::INET->new(LocalPort=>$hash->{PORT}, Proto=>'udp', Broadcast=>1, ReuseAddr=>1, ReusePort=>defined(&SO_REUSEPORT)?1:0) ) {
|
if( my $socket = IO::Socket::INET->new(LocalPort=>$hash->{PORT}, Proto=>'udp', Broadcast=>1, ReuseAddr=>1) ) {
|
||||||
readingsSingleUpdate($hash, 'state', 'listening', 1 );
|
readingsSingleUpdate($hash, 'state', 'listening', 1 );
|
||||||
Log3 $name, 3, "$name: listening";
|
Log3 $name, 3, "$name: listening";
|
||||||
$hash->{LAST_CONNECT} = FmtDateTime( gettimeofday() );
|
$hash->{LAST_CONNECT} = FmtDateTime( gettimeofday() );
|
||||||
|
@ -229,7 +229,7 @@ fakeRoku_startListener($)
|
|||||||
return undef if( AttrVal($name, "disable", 0 ) == 1 );
|
return undef if( AttrVal($name, "disable", 0 ) == 1 );
|
||||||
|
|
||||||
my $port = AttrVal($name, 'httpPort', 0);
|
my $port = AttrVal($name, 'httpPort', 0);
|
||||||
if( my $socket = IO::Socket::INET->new(LocalPort=>$port, Listen=>10, Blocking=>0, ReuseAddr=>1, ReusePort=>defined(&SO_REUSEPORT)?1:0) ) {
|
if( my $socket = IO::Socket::INET->new(LocalPort=>$port, Listen=>10, Blocking=>0, ReuseAddr=>1) ) {
|
||||||
readingsSingleUpdate($hash, 'state', 'listening', 1 );
|
readingsSingleUpdate($hash, 'state', 'listening', 1 );
|
||||||
|
|
||||||
|
|
||||||
|
@ -394,7 +394,7 @@ plex_startDiscovery($)
|
|||||||
}
|
}
|
||||||
|
|
||||||
# respond to broadcast client discovery messages
|
# respond to broadcast client discovery messages
|
||||||
#if( my $socket = new IO::Socket::INET ( Proto => 'udp', Broadcast => 1, LocalAddr => '0.0.0.0', LocalPort => 32412, ReuseAddr=>1, ReusePort=>defined(&SO_REUSEPORT)?1:0) ) {
|
#if( my $socket = new IO::Socket::INET ( Proto => 'udp', Broadcast => 1, LocalAddr => '0.0.0.0', LocalPort => 32412, ReuseAddr=>1) ) {
|
||||||
|
|
||||||
# my $chash = plex_newChash( $hash, $socket,
|
# my $chash = plex_newChash( $hash, $socket,
|
||||||
# {NAME=>"$name:clientDiscoveryResponderBcast", STATE=>'listening', broadcast => 1} );
|
# {NAME=>"$name:clientDiscoveryResponderBcast", STATE=>'listening', broadcast => 1} );
|
||||||
@ -605,7 +605,7 @@ plex_sendTimelines($$)
|
|||||||
if( $hash->{helper}{subscriptionsFrom}{$key} ) {
|
if( $hash->{helper}{subscriptionsFrom}{$key} ) {
|
||||||
$chash = $hash->{helper}{subscriptionsFrom}{$key};
|
$chash = $hash->{helper}{subscriptionsFrom}{$key};
|
||||||
|
|
||||||
} elsif( my $socket = IO::Socket::INET->new(PeerAddr=>$addr, Timeout=>2, Blocking=>1, ReuseAddr=>1, ReusePort=>defined(&SO_REUSEPORT)?1:0) ) {
|
} elsif( my $socket = IO::Socket::INET->new(PeerAddr=>$addr, Timeout=>2, Blocking=>1, ReuseAddr=>1) ) {
|
||||||
|
|
||||||
$chash = plex_newChash( $hash, $socket,
|
$chash = plex_newChash( $hash, $socket,
|
||||||
{NAME=>"$name:timelineSubscription:$addr", STATE=>'opened', timeline=>1} );
|
{NAME=>"$name:timelineSubscription:$addr", STATE=>'opened', timeline=>1} );
|
||||||
@ -743,7 +743,7 @@ plex_startTimelineListener($)
|
|||||||
return undef if( AttrVal($name, "disable", 0 ) == 1 );
|
return undef if( AttrVal($name, "disable", 0 ) == 1 );
|
||||||
|
|
||||||
my $port = AttrVal($name, 'httpPort', 0);
|
my $port = AttrVal($name, 'httpPort', 0);
|
||||||
if( my $socket = IO::Socket::INET->new(LocalPort=>$port, Listen=>10, Blocking=>0, ReuseAddr=>1, ReusePort=>defined(&SO_REUSEPORT)?1:0) ) {
|
if( my $socket = IO::Socket::INET->new(LocalPort=>$port, Listen=>10, Blocking=>0, ReuseAddr=>1) ) {
|
||||||
|
|
||||||
my $chash = plex_newChash( $hash, $socket,
|
my $chash = plex_newChash( $hash, $socket,
|
||||||
{NAME=>"$name:timelineListener", STATE=>'accepting'} );
|
{NAME=>"$name:timelineListener", STATE=>'accepting'} );
|
||||||
@ -1340,7 +1340,6 @@ plex_mediaList($$$)
|
|||||||
$xml->{title2} = encode('UTF-8', $xml->{title2}) if( $xml->{title2} );
|
$xml->{title2} = encode('UTF-8', $xml->{title2}) if( $xml->{title2} );
|
||||||
$xml->{title3} = encode('UTF-8', $xml->{title3}) if( $xml->{title3} );
|
$xml->{title3} = encode('UTF-8', $xml->{title3}) if( $xml->{title3} );
|
||||||
|
|
||||||
|
|
||||||
my $ret = '';
|
my $ret = '';
|
||||||
$ret .= plex_makeImage($hash, $server, $xml->{thumb}, 100);
|
$ret .= plex_makeImage($hash, $server, $xml->{thumb}, 100);
|
||||||
$ret .= plex_makeImage($hash, $server, $xml->{composite}, 100);
|
$ret .= plex_makeImage($hash, $server, $xml->{composite}, 100);
|
||||||
@ -2469,7 +2468,7 @@ plex_requestNotifications($$)
|
|||||||
|
|
||||||
return if( $hash->{helper}{websockets}{$server->{machineIdentifier}} );
|
return if( $hash->{helper}{websockets}{$server->{machineIdentifier}} );
|
||||||
|
|
||||||
if( my $socket = IO::Socket::INET->new(PeerAddr=>"$server->{address}:$server->{port}", Timeout=>2, Blocking=>1, ReuseAddr=>1, ReusePort=>defined(&SO_REUSEPORT)?1:0) ) {
|
if( my $socket = IO::Socket::INET->new(PeerAddr=>"$server->{address}:$server->{port}", Timeout=>2, Blocking=>1, ReuseAddr=>1) ) {
|
||||||
|
|
||||||
my $chash = plex_newChash( $hash, $socket,
|
my $chash = plex_newChash( $hash, $socket,
|
||||||
{NAME=>"$name:websocket:$server->{machineIdentifier}", STATE=>'listening', websocket=>0} );
|
{NAME=>"$name:websocket:$server->{machineIdentifier}", STATE=>'listening', websocket=>0} );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user