Fix crash in ClusterListener::ReplayLog().

This commit is contained in:
Gunnar Beutner 2013-10-11 08:19:58 +02:00
parent 834f9cd110
commit b204061d9f
1 changed files with 4 additions and 2 deletions

View File

@ -443,9 +443,13 @@ void ClusterListener::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Ptr
String message;
while (true) {
Dictionary::Ptr pmessage;
try {
if (!NetString::ReadStringFromStream(lstream, &message))
break;
pmessage = Value::Deserialize(message);
} catch (std::exception&) {
Log(LogWarning, "cluster", "Unexpected end-of-file for cluster log: " + path);
@ -453,8 +457,6 @@ void ClusterListener::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Ptr
break;
}
Dictionary::Ptr pmessage = Value::Deserialize(message);
if (pmessage->Get("timestamp") < peer_ts)
continue;