void ClusterComponent::RelayMessage(const Endpoint::Ptr& except, const Dictionary::Ptr& message, bool persistent)
{
- message->Set("ts", Utility::GetTime());
+ double ts = Utility::GetTime();
+ message->Set("ts", ts);
if (persistent) {
Dictionary::Ptr pmessage = boost::make_shared<Dictionary>();
- double ts = Utility::GetTime();
pmessage->Set("timestamp", ts);
if (except)
}
Dictionary::Ptr params = boost::make_shared<Dictionary>();
+ params->Set("identity", GetIdentity());
params->Set("config_files", config);
Dictionary::Ptr message = boost::make_shared<Dictionary>();
sender->SendMessage(lmessage);
sender->SetRemoteLogPosition(message->Get("ts"));
+
+ Log(LogInformation, "cluster", "Acknowledging log position: " + Utility::FormatDateTime("%Y/%m/%d %H:%M:%S", message->Get("ts")));
}
if (message->Get("method") == "cluster::HeartBeat") {
}
}
+ String identity = params->Get("identity");
+
if (!accept) {
- Log(LogWarning, "cluster", "Ignoring cluster::Config message from endpoint '" + sender->GetName() + "'.");
+ Log(LogWarning, "cluster", "Ignoring cluster::Config message from endpoint '" + sender->GetName() + "' for identity '" + identity + "'.");
return;
}
- String dir = GetClusterDir() + "config/" + SHA256(sender->GetName());
+ String dir = GetClusterDir() + "config/" + SHA256(identity);
Log(LogInformation, "cluster", "Creating cluster config directory: " + dir);
if (mkdir(dir.CStr(), 0700) < 0 && errno != EEXIST) {
BOOST_THROW_EXCEPTION(posix_error()