This commit is contained in:
2020-09-25 16:24:27 +08:00
parent bb2b1c9c20
commit 7b39203681
2 changed files with 7 additions and 1 deletions
+6
View File
@@ -4,6 +4,8 @@
#include <utility>
#include "BlockChainLogger.h"
#include "utils/RingBuffer.h"
#include <ndn-cxx/lp/cache-policy.hpp>
#include <ndn-cxx/lp/tags.hpp>
BlockChainLogger::BlockChainLogger(std::string shareMemoryName,
@@ -46,6 +48,10 @@ void BlockChainLogger::run() {
// 通过MIN的方式,将日志信息发给区块链
Interest interest((Name(prefix)));
interest.setMustBeFresh(true);
Data data;
ndn::lp::CachePolicy cachePolicy;
cachePolicy.setPolicy(ndn::lp::CachePolicyType::NO_CACHE);
data.setTag(make_shared<ndn::lp::CachePolicyTag>(cachePolicy));
interest.setApplicationParameters((const uint8_t *) buffer, offset);
keyChain.sign(interest);
face.expressInterest(interest, [](const Interest &interest1, const Data &data) {
+1 -1
View File
@@ -24,7 +24,7 @@ public:
explicit
BlockChainLogger(std::string shareMemoryName = "MIN-MIR-WARNING-LOG-TO-BLOCKCHAIN",
std::string host = "localhost", int port = 6363,
std::string prefix = "/mis1");
std::string prefix = "/mis1/msg");
/**
* 运行日志转发服务