2006-03-04 14:31:32 +00:00
|
|
|
|
|
|
|
|
|
#include "lowreceiver.h"
|
2006-03-06 12:14:40 +00:00
|
|
|
|
#include "messagecell_cb.h"
|
2006-03-04 14:31:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LowReceiver::manage_cbcast(Message * mesg) {
|
2006-03-06 12:42:03 +00:00
|
|
|
|
static std::list<MessageCellCb *> fifo_undelivered;
|
|
|
|
|
//static std::list<MessageCellCb *> fifo_send;
|
2006-03-04 14:31:32 +00:00
|
|
|
|
|
2006-03-06 12:14:40 +00:00
|
|
|
|
std::list<MessageCellCb *>::iterator iter;
|
2006-03-04 14:31:32 +00:00
|
|
|
|
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){
|
2006-03-06 12:42:03 +00:00
|
|
|
|
printf("LowReceiver::manage_cbcast - Received my own message -- delivering automatically\n");
|
2006-03-04 14:31:32 +00:00
|
|
|
|
//on faire la gestion du cbcast/send ici, c'est plus simple que
|
|
|
|
|
//de partager une variable+mutex avec le sender
|
2006-03-06 13:19:22 +00:00
|
|
|
|
//
|
|
|
|
|
_clock.adjust(mesg->getStamp());
|
2006-03-06 12:42:03 +00:00
|
|
|
|
|
2006-03-04 14:31:32 +00:00
|
|
|
|
} else {
|
|
|
|
|
printf("LowReceiver::manage_cbcast - Received a message from a friend\n");
|
2006-03-06 14:06:03 +00:00
|
|
|
|
|
|
|
|
|
_clock.adjust(mesg->getStamp());
|
2006-03-06 12:42:03 +00:00
|
|
|
|
// FIXME: si l'horloge est ajustable
|
|
|
|
|
// (donc les contraintes TS_m[j] = TS_m[j]+1 && ... ),
|
|
|
|
|
// alors on d<>livre directement
|
2006-03-04 14:31:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|