Actions
Task #2793
closedpingserver: refactor for separate responsibility
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 takeFace&
andOptions
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 inOptions
).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.
Actions