diff options
author | Aaron Seigo <aseigo@kde.org> | 2014-12-02 15:19:48 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2014-12-02 15:19:48 +0100 |
commit | 9c31df56c894892f20a30dc336cfe608b14679e0 (patch) | |
tree | 6b6d56d2aa714874daf914344f60ac8b89dbc8de /client/resourceaccess.cpp | |
parent | 1ff1928f58f860d71210032d5f0a8e69eb482d2a (diff) | |
download | sink-9c31df56c894892f20a30dc336cfe608b14679e0.tar.gz sink-9c31df56c894892f20a30dc336cfe608b14679e0.zip |
consolidate command writing to avoid duplicating those 4 lines everywhere
Diffstat (limited to 'client/resourceaccess.cpp')
-rw-r--r-- | client/resourceaccess.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/client/resourceaccess.cpp b/client/resourceaccess.cpp index 6d48c51..641c203 100644 --- a/client/resourceaccess.cpp +++ b/client/resourceaccess.cpp | |||
@@ -73,14 +73,10 @@ void ResourceAccess::connected() | |||
73 | 73 | ||
74 | { | 74 | { |
75 | flatbuffers::FlatBufferBuilder fbb; | 75 | flatbuffers::FlatBufferBuilder fbb; |
76 | auto name = fbb.CreateString("Client PID: " + QString::number((long long)this).toLatin1() + "!"); | 76 | auto name = fbb.CreateString(QString::number((long long)this).toLatin1()); |
77 | auto command = Akonadi::CreateHandshake(fbb, name); | 77 | auto command = Akonadi::CreateHandshake(fbb, name); |
78 | Akonadi::FinishHandshakeBuffer(fbb, command); | 78 | Akonadi::FinishHandshakeBuffer(fbb, command); |
79 | const int commandId = Commands::HandshakeCommand; | 79 | Commands::write(m_socket, Commands::HandshakeCommand, fbb); |
80 | const int dataSize = fbb.GetSize(); | ||
81 | m_socket->write((const char*)&commandId, sizeof(int)); | ||
82 | m_socket->write((const char*)&dataSize, sizeof(int)); | ||
83 | m_socket->write((const char*)fbb.GetBufferPointer(), dataSize); | ||
84 | } | 80 | } |
85 | 81 | ||
86 | emit ready(true); | 82 | emit ready(true); |