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
/
ad_xapp.cpp
diff --git
a/test/app/ad_xapp.cpp
b/test/app/ad_xapp.cpp
index
bb142d2
..
cc62c31
100644
(file)
--- a/
test/app/ad_xapp.cpp
+++ b/
test/app/ad_xapp.cpp
@@
-42,8
+42,10
@@
using namespace xapp;
unique_ptr<Xapp> xfw;
void ts_callback( Message& mbuf, int mtype, int subid, int len, Msg_component payload, void* data ) {
unique_ptr<Xapp> xfw;
void ts_callback( Message& mbuf, int mtype, int subid, int len, Msg_component payload, void* data ) {
+ string json ((char *)payload.get(), len);
+
cout << "[AD] TS Callback got a message, type=" << mtype << ", length=" << len << "\n";
cout << "[AD] TS Callback got a message, type=" << mtype << ", length=" << len << "\n";
- cout << "[AD] Payload is " <<
payload.get()
<< endl;
+ cout << "[AD] Payload is " <<
json
<< endl;
// we only send one message, so we expect to receive only one as well
xfw->Stop();
// we only send one message, so we expect to receive only one as well
xfw->Stop();
@@
-72,11
+74,7
@@
void ad_loop() {
payload = msg->Get_payload();
snprintf( (char *) payload.get(), 2048, "%s", ad_msg );
payload = msg->Get_payload();
snprintf( (char *) payload.get(), 2048, "%s", ad_msg );
- /*
- 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
- */
- plen = strlen( (char *) payload.get() ) + 1;
+ plen = strlen( (char *) payload.get() );
cout << "[AD] Sending a message to TS, length: " << plen << "\n";
cout << "[AD] Message body " << payload.get() << endl;
cout << "[AD] Sending a message to TS, length: " << plen << "\n";
cout << "[AD] Message body " << payload.get() << endl;