38 lines
1 KiB
C++
38 lines
1 KiB
C++
|
|
#include "lowreceiver.h"
|
|
#include "messagecell_cb.h"
|
|
|
|
|
|
void LowReceiver::manage_cbcast(Message * mesg) {
|
|
static std::list<MessageCellCb *> fifo_undelivered;
|
|
//static std::list<MessageCellCb *> fifo_send;
|
|
|
|
std::list<MessageCellCb *>::iterator iter;
|
|
printf("LowReceiver::manage_cbcast -- init\n");
|
|
|
|
// identifiant = horloge + id_site_emeteur
|
|
bool iAmTheEmitter = false;
|
|
bool firstSeenMessage = true;
|
|
|
|
if (mesg->getStamp().getIndex() == _group.getIndex()){
|
|
iAmTheEmitter = true;
|
|
}
|
|
|
|
if (iAmTheEmitter){
|
|
printf("LowReceiver::manage_cbcast - Received my own message -- delivering automatically\n");
|
|
//on faire la gestion du cbcast/send ici, c'est plus simple que
|
|
//de partager une variable+mutex avec le sender
|
|
//
|
|
_clock.adjust(mesg->getStamp());
|
|
|
|
} else {
|
|
printf("LowReceiver::manage_cbcast - Received a message from a friend\n");
|
|
|
|
_clock.adjust(mesg->getStamp());
|
|
// FIXME: si l'horloge est ajustable
|
|
// (donc les contraintes TS_m[j] = TS_m[j]+1 && ... ),
|
|
// alors on délivre directement
|
|
}
|
|
}
|
|
|
|
|