diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2023-05-06 17:09:32 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-05-06 18:54:24 +0200 |
commit | 25a1ba71e3cf4250489291f688423963aa603498 (patch) | |
tree | fb1e23060b810237316f4cde6524c0b1a66d5d0e /src/contact.cpp | |
parent | 07f61b1ad6363cd471b7dab3f94c3160636fd6a0 (diff) |
Server and services configuration using separate objects
Diffstat (limited to 'src/contact.cpp')
-rw-r--r-- | src/contact.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/contact.cpp b/src/contact.cpp index 787831c..0050f95 100644 --- a/src/contact.cpp +++ b/src/contact.cpp @@ -142,7 +142,12 @@ Ref ContactData::store(const Storage & st) const return st.storeObject(Record(std::move(items))); } -ContactService::ContactService() = default; +ContactService::ContactService(Config && config, const Server & s): + PairingService(move(config)), + server(s) +{ +} + ContactService::~ContactService() = default; UUID ContactService::uuid() const @@ -150,12 +155,6 @@ UUID ContactService::uuid() const return serviceUUID; } -void ContactService::serverStarted(const Server & s) -{ - PairingService<ContactAccepted>::serverStarted(s); - server = &s; -} - void ContactService::request(const Peer & peer) { requestPairing(serviceUUID, peer); @@ -163,7 +162,7 @@ void ContactService::request(const Peer & peer) Stored<ContactAccepted> ContactService::handlePairingComplete(const Peer & peer) { - server->localHead().update([&] (const Stored<LocalState> & local) { + server.localHead().update([&] (const Stored<LocalState> & local) { auto cdata = local.ref().storage().store(ContactData { .prev = {}, .identity = peer.identity()->finalOwner().data(), |