Project

General

Profile

Actions

Task #2793

closed

pingserver: refactor for separate responsibility

Added by Junxiao Shi about 9 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Start date:
Due date:
% Done:

0%

Estimated time:
4.00 h

Description

Refactor ndnpingserver program to use the following structure:

           |------------|
   Face <- |            | -> Tracer
           | PingServer |
Options -> |
           |------------|
  • An Options POD struct contains parameters parsed from command line.
  • PingServer class constructor should take Face& and Options as argument; getter/setter for each option are deleted from the class.
  • PingServer::run returns when expected number of Interests are processed (if a limit is specified in Options).
  • PingServer class shouldn't write to stdout directly; instead, it emits a signal for each processed Interest.
  • A Tracer class connects to the signals, and writes logs for each processed Interest.

Benefits:

  • separate responsibility: PingServer performs network operations, Tracer writes logs.
  • unit testing: passing DummyClientFace to Ping constructor allows unit testing.
  • simulation: PingServer can be reused in a ndnSIM scenario.

Related issues 1 (0 open1 closed)

Blocks ndn-tools - Feature #2796: Tests for Ping and PingServerClosedEric Newberry

Actions
Actions

Also available in: Atom PDF