27 lines
584 B
C++
27 lines
584 B
C++
|
|
||
|
#include "lowsender.h"
|
||
|
|
||
|
#define MESSAGE "AB or CB cast from LowSender ? hehe...."
|
||
|
|
||
|
LowSender::LowSender(Group &grp, Clock &clk, Protocol::Type type) : _group(grp), _clock(clk), _type(type) {
|
||
|
|
||
|
}
|
||
|
|
||
|
void LowSender::run(){
|
||
|
// thread part
|
||
|
while(1){
|
||
|
sleep(3);
|
||
|
printf("LowSender -- Broadcasting '%s'\n", MESSAGE);
|
||
|
|
||
|
TimeStamp ts = _clock.inc();
|
||
|
printf("LowSender::run -- Timestamp done\n");
|
||
|
|
||
|
Message msg(_type, ts, MESSAGE, strlen(MESSAGE));
|
||
|
printf("LowSender::run -- Mesg done and ready to send\n");
|
||
|
|
||
|
_group.broadcast(msg);
|
||
|
printf("LowSender::run -- Mesg sent\n");
|
||
|
}
|
||
|
}
|
||
|
|