Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
centreon
centreon-collect
Commits
e4283ddf
Commit
e4283ddf
authored
May 25, 2022
by
David Boucher
Browse files
fix(broker/stats): access simplified
parent
81f5da8f
Changes
2
Hide whitespace changes
Inline
Side-by-side
broker/stats/src/parser.cc
View file @
e4283ddf
/*
* Copyright 2011 - 202
1
Centreon (https://www.centreon.com/)
* Copyright 2011 - 202
2
Centreon (https://www.centreon.com/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
...
...
@@ -35,7 +35,7 @@ parser::parser() {}
parser
::~
parser
()
noexcept
{}
/**
* Parse a
XML
buffer.
* Parse a
JSON
buffer.
*
* @param[out] entries Parsed entries.
* @param[in] content XML content.
...
...
broker/stats/src/worker.cc
View file @
e4283ddf
...
...
@@ -76,7 +76,6 @@ void worker::_close() {
close
(
_fd
);
_fd
=
-
1
;
}
return
;
}
/**
...
...
@@ -106,7 +105,6 @@ void worker::_run() {
while
(
!
_exit
)
{
// Check file opening.
if
(
_buffer
.
empty
())
{
_close
();
usleep
(
100000
);
if
(
!
_open
())
continue
;
...
...
@@ -119,7 +117,7 @@ void worker::_run() {
fds
.
revents
=
0
;
// Multiplexing.
int
flagged
(
poll
(
&
fds
,
1
,
1000
)
)
;
int
flagged
=
poll
(
&
fds
,
1
,
1000
);
// Error.
if
(
flagged
<
0
)
{
...
...
@@ -142,11 +140,12 @@ void worker::_run() {
}
// Write data.
ssize_t
wb
(
write
(
_fd
,
_buffer
.
c_str
(),
_buffer
.
size
()));
if
(
wb
>
0
)
_buffer
.
erase
(
0
,
wb
);
else
_buffer
.
clear
();
ssize_t
delta
=
0
;
while
(
delta
<
_buffer
.
size
())
{
delta
+=
write
(
_fd
,
_buffer
.
c_str
()
+
delta
,
_buffer
.
size
()
-
delta
);
}
_close
();
_buffer
.
clear
();
}
}
}
...
...
Write
Preview
Supports
Markdown
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