Skip to content

Commit f5d1f54

Browse files
authored
Merge pull request #1 from 8th-ndn-hackathon/check-existing-in-publishName
Check for existing name in publishName
2 parents 5d8d047 + c793161 commit f5d1f54

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

PSync/full-producer-arbitrary.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ FullProducerArbitrary::~FullProducerArbitrary()
7171
void
7272
FullProducerArbitrary::publishName(const ndn::Name& name)
7373
{
74+
if (m_name2hash.find(name) != m_name2hash.end()) {
75+
NDN_LOG_DEBUG("Already published, ignoring: " << name);
76+
return;
77+
}
78+
7479
NDN_LOG_INFO("Publish: " << name);
7580

7681
insertToIBF(name);

PSync/full-producer-arbitrary.hpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,8 @@ class FullProducerArbitrary : public ProducerBase
9999
/**
100100
* @brief Publish name to let others know
101101
*
102-
* addUserNode needs to be called before this to add the prefix
103-
* if not already added via the constructor.
104-
* If seq is null then the seq of prefix is incremented by 1 else
105-
* the supplied sequence is set in the IBF.
106-
*
107-
* @param prefix the prefix to be updated
108-
* @param seq the sequence number of the prefix
102+
* However, if the name has already been published, do nothing.
103+
* @param name the Name to be updated
109104
*/
110105
void
111106
publishName(const ndn::Name& name);

0 commit comments

Comments
 (0)