network engine: add "value update" message type

This commit is contained in:
Adrien Béraud committed 2017-10-30 13:12:16 -04:00
1 parent 8cd3ff9fc4
commit fcaaa01b2d
3 files changed
+17 -4

No files matched your search

+10 -1
View File
@@ -410,7 +410,16 @@ NetworkEngine::process(std::unique_ptr<ParsedMessage>&& msg, const SockAddr& fro
const auto& now = scheduler.time();
auto node = cache.getNode(msg->id, from, now, true, msg->is_client);
if (msg->type == MessageType::Error or msg->type == MessageType::Reply) {
if (msg->type == MessageType::ValueUpdate) {
auto rsocket = node->getSocket(msg->tid);
if (not rsocket)
throw DhtProtocolException {DhtProtocolException::UNKNOWN_TID, "Can't find socket", msg->id};
node->received(now, {});
onNewNode(node, 2);
deserializeNodes(*msg, from);
rsocket->on_receive(node, std::move(*msg));
}
else if (msg->type == MessageType::Error or msg->type == MessageType::Reply) {
auto rsocket = node->getSocket(msg->tid);
auto req = node->getRequest(msg->tid);