Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origin/local #3

Open
wants to merge 3 commits into
base: local
Choose a base branch
from
Open

Origin/local #3

wants to merge 3 commits into from

Conversation

dulalsaurab
Copy link
Owner

No description provided.

#include <list>
#include <iostream>

// #include <list>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just remove?

@@ -225,13 +211,11 @@ ServiceDiscovery::sendData(const ndn::Name& name)
auto timeDiff = ndn::time::system_clock::now() - m_producerState.publishTimestamp;
auto timeToExpire = ndn::time::duration_cast<ndn::time::seconds>(timeDiff);

int status = (timeToExpire > m_producerState.serviceLifetime) ? EXPIRED : ACTIVE;
m_serviceStatus = (timeToExpire > m_producerState.serviceLifetime) ? EXPIRED : ACTIVE;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move lines 211-214 to wireEncode too.
And you need to still have a local variable serviceStatus
and then check with global variable. Otherwise no need to wireEncode again.

totalLength += encoder.prependVarNumber(totalLength);
totalLength += encoder.prependVarNumber(tlv::DiscoveryData);

return totalLength;
}

const ndn::Block&
ServiceDiscovery::wireEncode(const std::string& info, int status)
ServiceDiscovery::wireEncode()
{
if (m_wire.hasWire())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If hasWire, you should simply resend. The below string should be saved in a class member and then reset wire when this string is modified/updated.

@@ -375,19 +384,17 @@ ServiceDiscovery::wireDecode(const ndn::Block& wire)
}

wire.parse();
m_wire = wire;
ndn::Block::element_const_iterator it = wire.elements_begin();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auto

Copy link
Collaborator

@agawande agawande left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants