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
0c47685e
Commit
0c47685e
authored
Jul 29, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OtherCommands: split handle_update()
parent
e0ca4347
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
16 deletions
+22
-16
OtherCommands.cxx
src/command/OtherCommands.cxx
+22
-16
No files found.
src/command/OtherCommands.cxx
View file @
0c47685e
...
...
@@ -225,6 +225,25 @@ handle_lsinfo(Client &client, unsigned argc, char *argv[])
return
CommandResult
::
OK
;
}
#ifdef ENABLE_DATABASE
static
CommandResult
handle_update
(
Client
&
client
,
UpdateService
&
update
,
const
char
*
uri_utf8
,
bool
discard
)
{
unsigned
ret
=
update
.
Enqueue
(
uri_utf8
,
discard
);
if
(
ret
>
0
)
{
client_printf
(
client
,
"updating_db: %i
\n
"
,
ret
);
return
CommandResult
::
OK
;
}
else
{
command_error
(
client
,
ACK_ERROR_UPDATE_ALREADY
,
"already updating"
);
return
CommandResult
::
ERROR
;
}
}
#endif
static
CommandResult
handle_update
(
Client
&
client
,
unsigned
argc
,
char
*
argv
[],
bool
discard
)
{
...
...
@@ -246,29 +265,16 @@ handle_update(Client &client, unsigned argc, char *argv[], bool discard)
}
UpdateService
*
update
=
client
.
partition
.
instance
.
update
;
if
(
update
==
nullptr
)
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"No database"
);
return
CommandResult
::
ERROR
;
}
unsigned
ret
=
update
->
Enqueue
(
path
,
discard
);
if
(
ret
>
0
)
{
client_printf
(
client
,
"updating_db: %i
\n
"
,
ret
);
return
CommandResult
::
OK
;
}
else
{
command_error
(
client
,
ACK_ERROR_UPDATE_ALREADY
,
"already updating"
);
return
CommandResult
::
ERROR
;
}
if
(
update
!=
nullptr
)
return
handle_update
(
client
,
*
update
,
path
,
discard
);
#else
(
void
)
client
;
(
void
)
argc
;
(
void
)
argv
;
(
void
)
discard
;
#endif
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"No database"
);
return
CommandResult
::
ERROR
;
#endif
}
CommandResult
...
...
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