This commit is contained in:
parent
386295f69f
commit
30614ad733
1 changed files with 10 additions and 10 deletions
|
@ -1,13 +1,13 @@
|
|||
|
||||
#include "lowreceiver.h"
|
||||
#include "messagecell_ab.h"
|
||||
#include "messagecell_cb.h"
|
||||
|
||||
|
||||
void LowReceiver::manage_cbcast(Message * mesg) {
|
||||
static std::list<MessageCellAb *> fifo_get;
|
||||
static std::list<MessageCellAb *> fifo_send;
|
||||
static std::list<MessageCellCb *> fifo_get;
|
||||
static std::list<MessageCellCb *> fifo_send;
|
||||
|
||||
std::list<MessageCellAb *>::iterator iter;
|
||||
std::list<MessageCellCb *>::iterator iter;
|
||||
printf("LowReceiver::manage_cbcast -- init\n");
|
||||
|
||||
// identifiant = horloge + id_site_emeteur
|
||||
|
@ -24,11 +24,11 @@ void LowReceiver::manage_cbcast(Message * mesg) {
|
|||
//de partager une variable+mutex avec le sender
|
||||
|
||||
//FIXME: chercher si l'on a déja recu ce message
|
||||
MessageCellAb * cell = NULL;
|
||||
MessageCellCb * cell = NULL;
|
||||
for (iter = fifo_send.begin(); iter != fifo_send.end(); iter++){
|
||||
//on fait pointer cell sur la cellule si égale a l'id du message
|
||||
//courant
|
||||
MessageCellAb * cur = *iter;
|
||||
MessageCellCb * cur = *iter;
|
||||
if (cur->message == mesg){
|
||||
printf("LowReceiver::manage_cbcast -- message seen\n");
|
||||
firstSeenMessage = false;
|
||||
|
@ -39,7 +39,7 @@ void LowReceiver::manage_cbcast(Message * mesg) {
|
|||
if (firstSeenMessage){
|
||||
//sinon on le crée
|
||||
printf("LowReceiver::manage_cbcast -- message is first\n");
|
||||
cell = new MessageCellAb();
|
||||
cell = new MessageCellCb();
|
||||
cell->message = new Message(*mesg);
|
||||
//et on l'ajoute au fifo
|
||||
fifo_send.push_back(cell);
|
||||
|
@ -64,7 +64,7 @@ void LowReceiver::manage_cbcast(Message * mesg) {
|
|||
} else {
|
||||
printf("LowReceiver::manage_cbcast - Received a message from a friend\n");
|
||||
for (iter = fifo_get.begin(); iter != fifo_get.end(); iter++){
|
||||
MessageCellAb * cur = *iter;
|
||||
MessageCellCb * cur = *iter;
|
||||
if (cur->message == mesg) {
|
||||
printf("LowReceiver::manage_cbcast -- message seen\n");
|
||||
firstSeenMessage = false;
|
||||
|
@ -76,9 +76,9 @@ void LowReceiver::manage_cbcast(Message * mesg) {
|
|||
printf("LowReceiver::manage_cbcast -- message is first\n");
|
||||
// si le message est vu pour la premiere fois:
|
||||
// - on l'ajoute dans la liste d'attente
|
||||
MessageCellAb * cell = new MessageCellAb();
|
||||
MessageCellCb * cell = new MessageCellCb();
|
||||
cell->message = new Message(*mesg);
|
||||
cell->type = MessageCellAb::TYPE_TEMPORARY;
|
||||
cell->type = MessageCellCb::TYPE_TEMPORARY;
|
||||
// - on retourne une estampille(reception) a l'emeteur
|
||||
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue