86 lines
2.4 KiB
C++
86 lines
2.4 KiB
C++
/*
|
|
* File: NDMessageConfirm.cc
|
|
* Author: Grit Schneider
|
|
*
|
|
* Created on August 16, 2012, 10:52 AM
|
|
*/
|
|
|
|
#include "NDMessageConfirm.h"
|
|
|
|
#include "Dispatcher.h"
|
|
#include "common/validator/MessageValidator.h"
|
|
#include "fd/NetworkFailureDetector.h"
|
|
|
|
namespace ubeeme {
|
|
namespace moversight {
|
|
|
|
/**
|
|
* @brief Constructor
|
|
*/
|
|
NDMessageConfirm::NDMessageConfirm() : MoversightMessage("NDC", NDC) {
|
|
}
|
|
|
|
/**
|
|
* @brief Destructor
|
|
*/
|
|
NDMessageConfirm::~NDMessageConfirm() {
|
|
}
|
|
|
|
/**
|
|
* @brief Copy constructor
|
|
* @param other
|
|
*/
|
|
NDMessageConfirm::NDMessageConfirm(const NDMessageConfirm & other) : MoversightMessage(other) {
|
|
operator =(other);
|
|
}
|
|
|
|
/**
|
|
* @brief Creates a copy of the current message.
|
|
* @return The copy of the current message.
|
|
*/
|
|
NDMessageConfirm *
|
|
NDMessageConfirm::dup() const {
|
|
return new NDMessageConfirm(*this);
|
|
}
|
|
|
|
|
|
/**
|
|
* @brief Assignment operator.
|
|
* @param other The instance to assign.
|
|
* @return A reference to the local instance.
|
|
*/
|
|
NDMessageConfirm &
|
|
NDMessageConfirm::operator=(const NDMessageConfirm & other) {
|
|
MoversightMessage::operator =(other);
|
|
return *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
|
|
NDMessageConfirm::handleReceive( Dispatcher& dis) {
|
|
if( dis.getLocalSubState() != WAITING_FOR_REJOIN) {
|
|
if( dis.getMessageValidator()->isValid( *this)) {
|
|
dis.getNetworkFailureDetector().handleMessage(this);
|
|
}//end if
|
|
} else {
|
|
if (dis.getMembershipService().getLastMemberRegister().contains( dis.getLocalPeer().getPeerID())) {
|
|
dis.getNetworkFailureDetector().handleMessage(this);
|
|
}
|
|
}
|
|
}//
|
|
|
|
|
|
/**
|
|
* @brief Archive method
|
|
* @param archive The archive to which the attributes are to add
|
|
*/
|
|
void
|
|
NDMessageConfirm::set(Archive & archive) {
|
|
MoversightMessage::set(archive);
|
|
}
|
|
}
|
|
}
|