Code Review
/
ric-app
/
ts.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix extra nil termination char sent in RMR payload
[ric-app/ts.git]
/
test
/
app
/
qp_xapp.cpp
diff --git
a/test/app/qp_xapp.cpp
b/test/app/qp_xapp.cpp
index
c1a7502
..
242e568
100644
(file)
--- a/
test/app/qp_xapp.cpp
+++ b/
test/app/qp_xapp.cpp
@@
-53,15
+53,13
@@
unique_ptr<Xapp> xfw;
void prediction_callback( Message& mbuf, int mtype, int subid, int len, Msg_component payload, void* data ) {
void prediction_callback( Message& mbuf, int mtype, int subid, int len, Msg_component payload, void* data ) {
- cout << "[QP] Prediction Callback got a message, type=" << mtype << ", length=" << len << "\n";
- cout << "[QP] Payload is " << payload.get() << endl;
+ string json ((char *) payload.get(), len);
-
int randomNumber
;
-
srand( (unsigned int) time(0) )
;
+
cout << "[QP] Prediction Callback got a message, type=" << mtype << ", length=" << len << "\n"
;
+
cout << "[QP] Payload is " << json << endl
;
- const char *json = (const char *) payload.get();
Document document;
Document document;
- document.Parse(json);
+ document.Parse(json
.c_str()
);
const Value& uePred = document["UEPredictionSet"];
if ( uePred.Size() > 0 ) {
const Value& uePred = document["UEPredictionSet"];
if ( uePred.Size() > 0 ) {
@@
-78,11
+76,7
@@
void prediction_callback( Message& mbuf, int mtype, int subid, int len, Msg_comp
}
}
}
}
- /*
- we are sending a string, so we have to include the nil byte to send with RMR and keep
- things simple in the receiver side
- */
- int len = body.size() + 1;
+ int len = body.size();
cout << "[QP] Sending a message to TS, length=" << len << "\n";
cout << "[QP] Message body " << body << endl;
cout << "[QP] Sending a message to TS, length=" << len << "\n";
cout << "[QP] Message body " << body << endl;
@@
-96,6
+90,8
@@
void prediction_callback( Message& mbuf, int mtype, int subid, int len, Msg_comp
int main(int argc, char const *argv[]) {
int nthreads = 1;
int main(int argc, char const *argv[]) {
int nthreads = 1;
+ srand( (unsigned int) time(0) );
+
char* port = (char *) "4580";
cout << "[QP] listening on port " << port << endl;
char* port = (char *) "4580";
cout << "[QP] listening on port " << port << endl;