Project

General

Profile

Actions

Bug #4168

closed

Interest::setNonce affects other instances sharing buffer

Added by Junxiao Shi over 7 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Base
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
2.00 h

Description

Snippet to reproduce:

// g++ -std=c++11 -o x x.cpp $(pkg-config --cflags --libs libndn-cxx)

#include <ndn-cxx/interest.hpp>
#include <iostream>

int
main()
{
  ndn::Interest i1("/A");
  i1.setNonce(1);
  i1.wireEncode();
  std::cout << i1.getNonce() << ' ';
  ndn::Interest i2(i1);
  std::cout << i2.getNonce() << ' ';
  i2.setNonce(2);
  std::cout << i1.getNonce() << ' ';
  std::cout << i2.getNonce() << '\n';
}

Expected: Output is 1 1 2 1.
Actual: Output is 1 1 2 2.

Actions

Also available in: Atom PDF