diff options
Diffstat (limited to 'client/resourceaccess.cpp')
-rw-r--r-- | client/resourceaccess.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/client/resourceaccess.cpp b/client/resourceaccess.cpp index 2972316..b0a26e7 100644 --- a/client/resourceaccess.cpp +++ b/client/resourceaccess.cpp | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | #include "common/console.h" | 3 | #include "common/console.h" |
4 | #include "common/commands.h" | 4 | #include "common/commands.h" |
5 | #include "common/commands/handshake_generated.h" | ||
5 | 6 | ||
6 | #include <QDebug> | 7 | #include <QDebug> |
7 | #include <QProcess> | 8 | #include <QProcess> |
@@ -67,12 +68,15 @@ void ResourceAccess::connected() | |||
67 | Console::main()->log(QString("Connected: %1").arg(m_socket->fullServerName())); | 68 | Console::main()->log(QString("Connected: %1").arg(m_socket->fullServerName())); |
68 | 69 | ||
69 | { | 70 | { |
70 | const QByteArray name = QString::number((long long)this).toLatin1(); | 71 | flatbuffers::FlatBufferBuilder fbb; |
72 | auto name = fbb.CreateString("Client PID: " + QString::number((long long)this).toLatin1() + "!"); | ||
73 | auto command = Toynadi::CreateHandshake(fbb, name); | ||
74 | Toynadi::FinishHandshakeBuffer(fbb, command); | ||
71 | const int commandId = Commands::HandshakeCommand; | 75 | const int commandId = Commands::HandshakeCommand; |
72 | const int dataSize = name.size(); | 76 | const int dataSize = fbb.GetSize(); |
73 | m_socket->write((const char*)&commandId, sizeof(int)); | 77 | m_socket->write((const char*)&commandId, sizeof(int)); |
74 | m_socket->write((const char*)&dataSize, sizeof(int)); | 78 | m_socket->write((const char*)&dataSize, sizeof(int)); |
75 | m_socket->write(name.data(), name.size()); | 79 | m_socket->write((const char*)fbb.GetBufferPointer(), dataSize); |
76 | } | 80 | } |
77 | 81 | ||
78 | emit ready(true); | 82 | emit ready(true); |