aboutsummaryrefslogtreecommitdiff
path: root/client/src/main.cpp
diff options
context:
space:
mode:
authorauth <[email protected]>2020-06-30 23:31:36 +0200
committerauth <[email protected]>2020-06-30 23:31:36 +0200
commitd96c27220ad100b61332a0ac91bdb0300ef7e3be (patch)
tree3cd6289e6aa4c2a16621a2914ab68c2f723c6f00 /client/src/main.cpp
parentAdded json. (diff)
downloadloader-d96c27220ad100b61332a0ac91bdb0300ef7e3be.tar.xz
loader-d96c27220ad100b61332a0ac91bdb0300ef7e3be.zip
Added json implementation for packets.
Added useful operators for packet and server class for easier access.
Diffstat (limited to 'client/src/main.cpp')
-rw-r--r--client/src/main.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/client/src/main.cpp b/client/src/main.cpp
index 220afd6..c932b44 100644
--- a/client/src/main.cpp
+++ b/client/src/main.cpp
@@ -14,20 +14,21 @@ int main(int argc, char* argv[]) {
client.receive_event.add([&](tcp::packet_t& packet) {
if (!packet) return;
+ auto message = packet();
// first packet is the session id and current version
if (packet.id == 1) {
client.session_id = packet.session_id;
tcp::version_t v{0, 1, 0};
auto version = fmt::format("{}.{}.{}", v.major, v.minor, v.patch);
- if(version != packet.message) {
+ if(version != message) {
io::logger->error("please update your client");
client.shutdown();
}
return;
}
- io::logger->info("{}:{}->{}", packet.id, packet.session_id, packet.message);
+ io::logger->info("{}:{}->{}", packet.id, packet.session_id, message);
});
while (client) {