mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-16 05:43:54 +03:00
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/jellyfin/jellyfin/pull/3383
Author: @BaronGreenback
Created: 6/19/2020
Status: ❌ Closed
Base:
master← Head:Mono📝 Commits (9)
31a221fImported Mono.Nat5ba6e33DeviceLost, FinishDiscovery, BeginDiscovery implemented.f0bc8d0Created initial version of InternetChecker.cs which checks if we we have internet access.d6fc087Packages updated503cfd0Fixed issue in Mono, and put additional locks on portforwardingd741380Bug fix6c43e32Implimented Ping monitoring of the gateway routers in an attempt to ensure inbound access is always available.8eddec5Fixes issue outlined here.a5e77b6Fixed resolve.📊 Changes
60 files changed (+5160 additions, -89 deletions)
View changed files
➕
Common/Networking/Common.Networking.csproj(+44 -0)➕
Common/Networking/InternetAccess/GatewayEventArgs.cs(+33 -0)➕
Common/Networking/InternetAccess/GatewayMonitor.cs(+230 -0)➕
Common/Networking/InternetAccess/IGatewayMonitor.cs(+29 -0)➕
Common/Networking/InternetAccess/Properties/AssemblyInfo.cs(+36 -0)📝
Emby.Server.Implementations/ApplicationHost.cs(+3 -0)📝
Emby.Server.Implementations/Emby.Server.Implementations.csproj(+4 -3)📝
Emby.Server.Implementations/EntryPoints/ExternalPortForwarding.cs(+184 -58)📝
Emby.Server.Implementations/ScheduledTasks/ScheduledTaskWorker.cs(+14 -9)📝
Jellyfin.Server/Properties/launchSettings.json(+4 -3)📝
MediaBrowser.Model/Configuration/ServerConfiguration.cs(+7 -0)📝
MediaBrowser.sln(+34 -15)➕
Mono.Nat/AssemblyInfo.cs(+8 -0)➕
Mono.Nat/AsyncExtensions.cs(+131 -0)➕
Mono.Nat/AsyncResults/TaskAsyncResult.cs(+96 -0)➕
Mono.Nat/Copyright.txt(+23 -0)➕
Mono.Nat/Enums/NatProtocol.cs(+42 -0)➕
Mono.Nat/Enums/ProtocolType.cs(+42 -0)➕
Mono.Nat/EventArgs/DeviceEventArgs.cs(+48 -0)➕
Mono.Nat/Exceptions/MappingException.cs(+116 -0)...and 40 more files
📄 Description
Author has changed Mono.NAT in light of the issues found. Am currently testing that out.
Fixes
Bug 1) If pnp forwarding is disabled, Mono keeps the device list and udp sockets. (Memory should ideally be freed up).
Fix: The implementation of Mono included is no longer a singleton, and clears memory/ closes sockets when pnp forwarding is disabled.
Bug 2: Security wise, if UPNP is disabled, the port forwarding mappings should be removed, but the RaiseDeviceLost event in mono isn't attached to anything.
Fix: As it's now an instance, the RaiseDeviceLost method is now triggered once pnp-forwarding is disabled, and an attempt is made to remove the ports on the router..
Bug3: If something happens to the router (ie. reboot), then as the device stays in the mono's device list, it won't be re-discovered, so there is no way of remapping ports. A restart of jellyfin will be required to get it working again.
Fix: Have linked Mono to the network change event. A change in the network also stops, clears the devices and re-starts the UPNP scan. This means that if it was a router reboot, Jellyfin will pick up the device again, and re-insert the port-forwarding.
In addition, every router scanned is now added to a monitor that will ping it every 30 seconds (configurable in the options). If it doesn't reply to pings for some reason, it triggers a gateway down event, which in turn - restarts the port-forwarding.
Bug 4: If there are any network changes after Jellyfin starts - the mono class will never reflect these.
Fix: Linked into the config change event, which restarts the port-forwarding.
Changes to Mono.NAT
FIX: - It now broadcasts for "urn:schemas-upnp-org:device:InternetGatewayDevice"
Devices with dual functionality (eg wifi-routers) sometimes only respond to ST: ssdp-all with one view of their device. In my case, my router returned "urn:schemas-wifialliance-org:device:WFADevice:1" meaning PNP-forwarding didn't work. It does now.
Changes to Jellyfin
Removed the _deviceDiscovery.DeviceDiscovered event, as i can only assume this was implemented as Mono wasn't detecting devices like mine.
Removed the multi-fire code (ExternalPortforwarding.cs) as we should now be able to identify the cause, and duplication checking is already present in the Mono code.
Mono.NAT changes
NatUtility.cs
Searcher.cs
UPNPSearcher.cs
PNPSearcher.cs
DiscoverDeviceMessage.cs
ResponseMessages.cs
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.