diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2023-07-23 16:25:37 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-07-23 16:52:55 +0200 |
commit | ec2229471d4f7e9d10cee41c25ba544c59dc84a1 (patch) | |
tree | 902b82d09fefcbda32b14c0c9e0d71b415f42be1 | |
parent | 104b88eb9c966c476906beaa5339d050560d98b7 (diff) |
Network: request service ref data if needed
-rw-r--r-- | src/network.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/network.cpp b/src/network.cpp index 305f073..cd13bc4 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -642,18 +642,19 @@ void Server::Priv::handlePacket(Server::Peer & peer, const TransportHeader & hea if (!serviceType) break; - if (auto pref = std::get<PartialRef>(item.value)) { - shared_ptr<WaitingRef> wref(new WaitingRef { - .storage = peer.tempStorage, + auto pref = std::get<PartialRef>(item.value); + if (pref) + reply.header({ TransportHeader::Type::Acknowledged, pref }); + + shared_ptr<WaitingRef> wref(new WaitingRef { + .storage = peer.tempStorage, .ref = pref, .peer = peer, .missing = {}, - }); - waiting.push_back(wref); - peer.serviceQueue.emplace_back(*serviceType, wref); - reply.header({ TransportHeader::Type::Acknowledged, pref }); - wref->check(reply); - } + }); + waiting.push_back(wref); + peer.serviceQueue.emplace_back(*serviceType, wref); + wref->check(reply); } } } |