Project

General

Profile

Actions

Bug #1759

closed

Transport::connect() should be issued the same thread as Transport::send()

Added by Alex Afanasyev over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Category:
Base
Target version:
Start date:
07/13/2014
Due date:
% Done:

100%

Estimated time:

Description

In certain cases, previous version caused connect() to fail (stopped io_service due to exception) before send() is dispatched. This could have resulted in incorrectly calling Transport::send with old buffer when io_service resumes.

The following code snippet (from NFD Control Center) that ensures that face is still alive and retries when face fails can cause the described problem

  while (true) {
    try {
      while (true) {
        m_face.expressInterest(Interest("/localhost/nfd/status"),
                               bind(&Ncc::onStatusRetrieved, this, _2),
                               bind(&Ncc::onStatusTimeout, this));
        m_face.processEvents(time::milliseconds::zero(), true);
      }
    }
    catch (const std::exception&e) {
      boost::this_thread::sleep(boost::posix_time::seconds(1));
    }
  }

To cause problem, start snippet with stopped NFD or stop/start NFD while snippet is running.

Actions

Also available in: Atom PDF