Files
2014-06-30 13:58:10 +02:00

98 lines
2.9 KiB
C++

#include "RejoinFailed.h"
#include "Dispatcher.h"
#include "common/validator/MessageValidator.h"
#include "fd/NetworkFailureDetector.h"
namespace ubeeme {
namespace moversight {
/**
* @brief Default Constructor
*/
RejoinFailed::RejoinFailed() : MulticastMessage("RF", RF) {
}
/**
* @brief Copy constructor
* @param other The instance to copy
*/
RejoinFailed::RejoinFailed(const RejoinFailed &other) : MulticastMessage(other) {
operator =(other);
}
/**
* @brief Assignment operator
* @param other The instance to assign.
* @return A reference to the local instance.
*/
RejoinFailed &
RejoinFailed::operator=(const RejoinFailed & other) {
if (this == &other) return *this;
MulticastMessage::operator=(other);
return *this;
}
/**
* @brief Destructor
*/
RejoinFailed::~RejoinFailed() {
}
/**
* @brief Duplicate method. Creates a copy of the current message.
* @return The copy of the current instance.
*/
RejoinFailed *
RejoinFailed::dup() const {
return new RejoinFailed(*this);
}
/**
* @brief Handles this message. To handle a message, it has first successfully validated.
* @param dis A reference to the dispatcher, used to forward this message to the handling modules.
*/
void
RejoinFailed::handleReceive(Dispatcher & dis) {
// @NOTE not validated?
//validate the message
// if (dis.getMessageValidator()->isValid(this)) {
//notify the NFD about ongoing traffic
dis.getNetworkFailureDetector().handleMessage(this);
//handle the message
dis.getMessageTransfer().handleMessage(this);
// }//End if
}
/**
* @brief Handles the message delivering. To deliver a message, the message to each module which is interested in this message.
* @param dis A reference to the dispatcher, used to forward this message to the handling modules.
* @param missedPeers A list of peers, which have missed this message, as they are pending.
*/
void
RejoinFailed::handleDeliver(Dispatcher & dis, const PeerIDList & missedPeers ) {
// @NOTE not stored?
//store the message for re-synchronization
//dis.getMobilitySupport().storeMessage(*this);
//process the message
dis.getMobilitySupport().handleRejoinFailedMessage(*this, missedPeers);
}
/**
* @brief Archive method.
* @param archive The archive to which the attributes are to add
*/
void
RejoinFailed::set(Archive & archive) {
MulticastMessage::set(archive);
}
}
}