mirror of
https://github.com/rclone/rclone
synced 2024-11-23 00:06:55 +01:00
dlna: add SSDP AnnounceInterval flag option
The current default AnnounceInterval is too short, causing the multicast domain to be flooded with NOTIFY announcements, which may prevent other dlna devices from sleeping. This change allows users to set the announcement interval, and it's default value also increased to 12 minutes. Even within the interval, rclone can still passively respond to M-SEARCH requests from other devices.
This commit is contained in:
parent
4a35aff33c
commit
13b65104eb
@ -118,7 +118,7 @@ func newServer(f fs.Fs, opt *dlnaflags.Options) (*server, error) {
|
||||
}
|
||||
|
||||
s := &server{
|
||||
AnnounceInterval: 10 * time.Second,
|
||||
AnnounceInterval: opt.AnnounceInterval,
|
||||
FriendlyName: friendlyName,
|
||||
RootDeviceUUID: makeDeviceUUID(friendlyName),
|
||||
Interfaces: interfaces,
|
||||
|
@ -2,6 +2,8 @@
|
||||
package dlnaflags
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/rclone/rclone/fs/config/flags"
|
||||
"github.com/rclone/rclone/fs/rc"
|
||||
"github.com/spf13/pflag"
|
||||
@ -24,18 +26,20 @@ logging of all UPNP traffic.
|
||||
|
||||
// Options is the type for DLNA serving options.
|
||||
type Options struct {
|
||||
ListenAddr string
|
||||
FriendlyName string
|
||||
LogTrace bool
|
||||
InterfaceNames []string
|
||||
ListenAddr string
|
||||
FriendlyName string
|
||||
LogTrace bool
|
||||
InterfaceNames []string
|
||||
AnnounceInterval time.Duration
|
||||
}
|
||||
|
||||
// DefaultOpt contains the defaults options for DLNA serving.
|
||||
var DefaultOpt = Options{
|
||||
ListenAddr: ":7879",
|
||||
FriendlyName: "",
|
||||
LogTrace: false,
|
||||
InterfaceNames: []string{},
|
||||
ListenAddr: ":7879",
|
||||
FriendlyName: "",
|
||||
LogTrace: false,
|
||||
InterfaceNames: []string{},
|
||||
AnnounceInterval: 12 * time.Minute,
|
||||
}
|
||||
|
||||
// Opt contains the options for DLNA serving.
|
||||
@ -49,6 +53,7 @@ func addFlagsPrefix(flagSet *pflag.FlagSet, prefix string, Opt *Options) {
|
||||
flags.StringVarP(flagSet, &Opt.FriendlyName, prefix+"name", "", Opt.FriendlyName, "Name of DLNA server")
|
||||
flags.BoolVarP(flagSet, &Opt.LogTrace, prefix+"log-trace", "", Opt.LogTrace, "Enable trace logging of SOAP traffic")
|
||||
flags.StringArrayVarP(flagSet, &Opt.InterfaceNames, prefix+"interface", "", Opt.InterfaceNames, "The interface to use for SSDP (repeat as necessary)")
|
||||
flags.DurationVarP(flagSet, &Opt.AnnounceInterval, prefix+"announce-interval", "", Opt.AnnounceInterval, "The interval between SSDP announcements")
|
||||
}
|
||||
|
||||
// AddFlags add the command line flags for DLNA serving.
|
||||
|
@ -32,6 +32,11 @@ IPs.
|
||||
Use `--name` to choose the friendly server name, which is by
|
||||
default "rclone (hostname)".
|
||||
|
||||
Use `--announce-interval` to specify the interval at which SSDP server
|
||||
announce devices and services. Larger active announcement intervals help
|
||||
keep the multicast domain clean, this value does not affect unicast
|
||||
responses to `M-SEARCH` requests from other devices.
|
||||
|
||||
Use `--log-trace` in conjunction with `-vv` to enable additional debug
|
||||
logging of all UPNP traffic.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user