| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Pierre Aubert | ||
| 3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #include "Sender.h" | ||
| 8 | #include <thread> | ||
| 9 | |||
| 10 | /// Default constructor of Sender | ||
| 11 | 1 | Sender::Sender(){ | |
| 12 | 1 | initialisationSender(); | |
| 13 | 1 | } | |
| 14 | |||
| 15 | /// Destructor of Sender | ||
| 16 | 1 | Sender::~Sender(){} | |
| 17 | |||
| 18 | /// Initialisation function of the class Sender | ||
| 19 | 1 | void Sender::initialisationSender(){ | |
| 20 | 1 | p_sendIndex = 0; | |
| 21 | 1 | } | |
| 22 | |||
| 23 | /// @brief Wait that the Sender has received the confirmation of sent Stats | ||
| 24 | 1 | void Sender::executeOnStop(){ | |
| 25 |
2/2✓ Branch 0 (20→3) taken 7 times.
✓ Branch 1 (20→21) taken 1 times.
|
8 | while(!getMapMessageToBeConfirmed().empty()){ |
| 26 |
4/4✓ Branch 0 (3→4) taken 7 times.
✓ Branch 2 (4→5) taken 7 times.
✓ Branch 4 (5→6) taken 7 times.
✓ Branch 6 (6→7) taken 7 times.
|
7 | getLog().getLogDebug() << "Sender::executeOnStop() : Waiting for confirmation of StatDaemon..." << std::endl; |
| 27 |
1/1✓ Branch 0 (7→8) taken 7 times.
|
7 | Message msgToCheck; |
| 28 |
3/3✓ Branch 0 (8→9) taken 7 times.
✓ Branch 2 (9→10) taken 7 times.
✓ Branch 4 (10→11) taken 7 times.
|
7 | PRecvStatus::PRecvStatus recvStatus = checkRecvStatus(p_backend.socketManager.recvData("pull", msgToCheck, p_mainConfig.recvFlag)); |
| 29 |
2/2✓ Branch 0 (12→13) taken 1 times.
✓ Branch 1 (12→14) taken 6 times.
|
7 | if(recvStatus == PRecvStatus::OK){ |
| 30 |
1/1✓ Branch 0 (13→14) taken 1 times.
|
1 | processInputMessage(msgToCheck); |
| 31 | } | ||
| 32 |
1/1✓ Branch 0 (15→16) taken 7 times.
|
7 | std::this_thread::sleep_for(std::chrono::milliseconds(10)); // Sleep to avoid CPU consumption |
| 33 | 7 | } | |
| 34 | 1 | getLog().getLogDebug() << "Sender::executeOnStop() : Sender stopping after receiving confirmation for Stats!" << std::endl; | |
| 35 | 1 | } | |
| 36 | |||
| 37 | /// @brief Send 5 Shadok then stop | ||
| 38 | 118 | void Sender::extraLoopProcessing(){ | |
| 39 |
2/2✓ Branch 0 (2→3) taken 5 times.
✓ Branch 1 (2→33) taken 113 times.
|
118 | if(p_sendIndex < 5){ |
| 40 |
2/2✓ Branch 0 (3→4) taken 5 times.
✓ Branch 2 (4→5) taken 5 times.
|
5 | Shadok shadok("Shadoko", p_sendIndex); |
| 41 |
6/6✓ Branch 0 (8→9) taken 5 times.
✓ Branch 2 (11→12) taken 5 times.
✓ Branch 4 (14→15) taken 5 times.
✓ Branch 6 (15→16) taken 5 times.
✓ Branch 8 (16→17) taken 5 times.
✓ Branch 10 (17→18) taken 5 times.
|
25 | phoenix_assert(sendValue("receiver", shadok, true)); |
| 42 | 5 | p_sendIndex++; | |
| 43 |
6/6✓ Branch 0 (25→26) taken 5 times.
✓ Branch 2 (26→27) taken 5 times.
✓ Branch 4 (27→28) taken 5 times.
✓ Branch 6 (28→29) taken 5 times.
✓ Branch 8 (29→30) taken 5 times.
✓ Branch 10 (30→31) taken 5 times.
|
5 | getLog().getLogDebug() << "Sent " << p_sendIndex << " Shadok!" << std::endl; |
| 44 | 5 | } | |
| 45 |
6/6✓ Branch 0 (33→34) taken 114 times.
✓ Branch 1 (33→38) taken 4 times.
✓ Branch 2 (36→37) taken 1 times.
✓ Branch 3 (36→38) taken 113 times.
✓ Branch 4 (39→40) taken 1 times.
✓ Branch 5 (39→41) taken 117 times.
|
118 | if (p_sendIndex >= 5 && getMapMessageToBeConfirmed().empty()){ |
| 46 | 1 | stop(); | |
| 47 | } | ||
| 48 | 118 | } | |
| 49 |