Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
42af040f
Commit
42af040f
authored
Aug 24, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
StateFile: configurable interval
parent
d383d617
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
4 deletions
+27
-4
user.xml
doc/user.xml
+12
-0
Main.cxx
src/Main.cxx
+4
-1
StateFile.cxx
src/StateFile.cxx
+3
-2
StateFile.hxx
src/StateFile.hxx
+6
-1
ConfigOption.hxx
src/config/ConfigOption.hxx
+1
-0
ConfigTemplates.cxx
src/config/ConfigTemplates.cxx
+1
-0
No files found.
doc/user.xml
View file @
42af040f
...
...
@@ -898,6 +898,18 @@ systemctl start mpd.socket</programlisting>
(
<parameter>
+wx
</parameter>
).
</entry>
</row>
<row>
<entry>
<varname>
state_file_interval
</varname>
<parameter>
SECONDS
</parameter>
</entry>
<entry>
Auto-save the state file this number of seconds
after each state change. Defaults to
<parameter>
120
</parameter>
(2 minutes).
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
...
...
src/Main.cxx
View file @
42af040f
...
...
@@ -279,7 +279,10 @@ glue_state_file_init(Error &error)
#endif
}
state_file
=
new
StateFile
(
std
::
move
(
path_fs
),
unsigned
interval
=
config_get_unsigned
(
CONF_STATE_FILE_INTERVAL
,
StateFile
::
DEFAULT_INTERVAL
);
state_file
=
new
StateFile
(
std
::
move
(
path_fs
),
interval
,
*
instance
->
partition
,
*
instance
->
event_loop
);
state_file
->
Read
();
...
...
src/StateFile.cxx
View file @
42af040f
...
...
@@ -36,10 +36,11 @@
static
constexpr
Domain
state_file_domain
(
"state_file"
);
StateFile
::
StateFile
(
AllocatedPath
&&
_path
,
StateFile
::
StateFile
(
AllocatedPath
&&
_path
,
unsigned
_interval
,
Partition
&
_partition
,
EventLoop
&
_loop
)
:
TimeoutMonitor
(
_loop
),
path
(
std
::
move
(
_path
)),
path_utf8
(
path
.
ToUTF8
()),
interval
(
_interval
),
partition
(
_partition
),
prev_volume_version
(
0
),
prev_output_version
(
0
),
prev_playlist_version
(
0
)
...
...
@@ -137,7 +138,7 @@ void
StateFile
::
CheckModified
()
{
if
(
!
IsActive
()
&&
IsModified
())
ScheduleSeconds
(
2
*
60
);
ScheduleSeconds
(
interval
);
}
void
...
...
src/StateFile.hxx
View file @
42af040f
...
...
@@ -34,6 +34,8 @@ class StateFile final : private TimeoutMonitor {
const
AllocatedPath
path
;
const
std
::
string
path_utf8
;
const
unsigned
interval
;
Partition
&
partition
;
/**
...
...
@@ -44,7 +46,10 @@ class StateFile final : private TimeoutMonitor {
prev_playlist_version
;
public
:
StateFile
(
AllocatedPath
&&
path
,
Partition
&
partition
,
EventLoop
&
loop
);
static
constexpr
unsigned
DEFAULT_INTERVAL
=
2
*
60
;
StateFile
(
AllocatedPath
&&
path
,
unsigned
interval
,
Partition
&
partition
,
EventLoop
&
loop
);
void
Read
();
void
Write
();
...
...
src/config/ConfigOption.hxx
View file @
42af040f
...
...
@@ -32,6 +32,7 @@ enum ConfigOption {
CONF_LOG_FILE
,
CONF_PID_FILE
,
CONF_STATE_FILE
,
CONF_STATE_FILE_INTERVAL
,
CONF_RESTORE_PAUSED
,
CONF_USER
,
CONF_GROUP
,
...
...
src/config/ConfigTemplates.cxx
View file @
42af040f
...
...
@@ -32,6 +32,7 @@ const ConfigTemplate config_templates[] = {
{
"log_file"
,
false
,
false
},
{
"pid_file"
,
false
,
false
},
{
"state_file"
,
false
,
false
},
{
"state_file_interval"
,
false
,
false
},
{
"restore_paused"
,
false
,
false
},
{
"user"
,
false
,
false
},
{
"group"
,
false
,
false
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment