Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
IQRF Gateway Daemon
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
38
Issues
38
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Open source
IQRF Gateway Daemon
Commits
59ff4e60
Commit
59ff4e60
authored
Oct 28, 2020
by
Karel Hanák
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JsonSplitter: preserve msgId if validation fails or message queue is full
Signed-off-by:
Karel Hanák
<
karel.hanak@microrisc.com
>
parent
adfa4832
Pipeline
#4256
passed with stages
in 7 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
src/JsonSplitter/JsonSplitter.cpp
src/JsonSplitter/JsonSplitter.cpp
+10
-2
No files found.
src/JsonSplitter/JsonSplitter.cpp
View file @
59ff4e60
...
...
@@ -278,11 +278,18 @@ namespace iqrf {
else
{
TRC_WARNING
(
"Error queue overload: "
<<
PAR
(
queueLen
));
std
::
string
msgId
(
"ignored"
);
std
::
string
str
((
char
*
)
message
.
data
(),
message
.
size
());
StringStream
ss
(
str
.
data
());
Document
doc
;
doc
.
ParseStream
(
ss
);
if
(
!
doc
.
HasParseError
())
{
msgId
=
Pointer
(
"/data/msgId"
).
GetWithDefault
(
doc
,
"undefined"
).
GetString
();
}
std
::
ostringstream
oser
;
oser
<<
"daemon overload: "
<<
PAR
(
queueLen
);
Document
rspDoc
;
MessageErrorMsg
msg
(
"ignored"
,
str
,
oser
.
str
());
MessageErrorMsg
msg
(
msgId
,
str
,
oser
.
str
());
msg
.
createResponse
(
rspDoc
);
try
{
sendMessage
(
messagingId
,
std
::
move
(
rspDoc
));
...
...
@@ -307,11 +314,11 @@ namespace iqrf {
{
using
namespace
rapidjson
;
std
::
string
msgId
(
"undefined"
);
std
::
string
str
((
char
*
)
message
.
data
(),
message
.
size
());
StringStream
sstr
(
str
.
data
());
Document
doc
;
doc
.
ParseStream
(
sstr
);
std
::
string
msgId
(
"undefined"
);
try
{
if
(
doc
.
HasParseError
())
{
...
...
@@ -320,6 +327,7 @@ namespace iqrf {
NAME_PAR
(
eoffset
,
doc
.
GetErrorOffset
()));
}
msgId
=
Pointer
(
"/data/msgId"
).
GetWithDefault
(
doc
,
"undefined"
).
GetString
();
MsgType
msgType
=
getMessageType
(
doc
);
if
(
msgType
.
m_type
!=
"dpaV1"
)
{
// dpaV1 is default legacy support
...
...
Karel Hanák
@hanakk
mentioned in issue
#174 (closed)
·
Dec 24, 2020
mentioned in issue
#174 (closed)
mentioned in issue #174
Toggle commit list
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