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
7d1db5c1
Commit
7d1db5c1
authored
Apr 03, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client/Process: refactor IsExpired() checks
parent
2142d070
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
Process.cxx
src/client/Process.cxx
+10
-8
No files found.
src/client/Process.cxx
View file @
7d1db5c1
...
...
@@ -34,22 +34,23 @@ inline CommandResult
Client
::
ProcessCommandList
(
bool
list_ok
,
std
::
list
<
std
::
string
>
&&
list
)
noexcept
{
CommandResult
ret
=
CommandResult
::
OK
;
unsigned
n
=
0
;
for
(
auto
&&
i
:
list
)
{
char
*
cmd
=
&*
i
.
begin
();
FormatDebug
(
client_domain
,
"process command
\"
%s
\"
"
,
cmd
);
ret
=
command_process
(
*
this
,
n
++
,
cmd
);
auto
ret
=
command_process
(
*
this
,
n
++
,
cmd
);
FormatDebug
(
client_domain
,
"command returned %i"
,
int
(
ret
));
if
(
ret
!=
CommandResult
::
OK
||
IsExpired
())
break
;
if
(
IsExpired
())
return
CommandResult
::
CLOSE
;
else
if
(
ret
!=
CommandResult
::
OK
)
return
ret
;
else
if
(
list_ok
)
Write
(
"list_OK
\n
"
);
}
return
ret
;
return
CommandResult
::
OK
;
}
CommandResult
...
...
@@ -100,10 +101,11 @@ Client::ProcessLine(char *line) noexcept
"[%u] process command "
"list returned %i"
,
num
,
int
(
ret
));
if
(
ret
==
CommandResult
::
CLOSE
||
IsExpired
())
if
(
ret
==
CommandResult
::
CLOSE
)
return
CommandResult
::
CLOSE
;
assert
(
!
IsExpired
());
if
(
ret
==
CommandResult
::
OK
)
command_success
(
*
this
);
...
...
@@ -138,7 +140,7 @@ Client::ProcessLine(char *line) noexcept
"[%u] command returned %i"
,
num
,
int
(
ret
));
if
(
ret
==
CommandResult
::
CLOSE
||
IsExpired
())
if
(
IsExpired
())
return
CommandResult
::
CLOSE
;
if
(
ret
==
CommandResult
::
OK
)
...
...
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