diff options
Diffstat (limited to 'src/Net/Connection.cpp')
-rw-r--r-- | src/Net/Connection.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Net/Connection.cpp b/src/Net/Connection.cpp index ac3121d..6a30d11 100644 --- a/src/Net/Connection.cpp +++ b/src/Net/Connection.cpp @@ -77,13 +77,13 @@ void Connection::packetHeaderReceiveHandler(const void *data, unsigned long leng header = *reinterpret_cast<const Packet::Data*>(data); if(header.length == 0) { - signal(this, Packet(static_cast<Packet::Type>(header.type), header.requestId)); + signal(this, Packet((Packet::Type)ntohs(header.type), ntohs(header.requestId))); enterReceiveLoop(); } else { state = PACKET_DATA; - rawReceive(header.length, sigc::mem_fun(this, &Connection::packetDataReceiveHandler)); + rawReceive(ntohs(header.length), sigc::mem_fun(this, &Connection::packetDataReceiveHandler)); } } @@ -91,13 +91,13 @@ void Connection::packetDataReceiveHandler(const void *data, unsigned long length if(state != PACKET_DATA) return; - if(length != header.length) { + if(length != ntohs(header.length)) { // TODO: Error doDisconnect(); return; } - signal(this, Packet(static_cast<Packet::Type>(header.type), header.requestId, data, length)); + signal(this, Packet((Packet::Type)ntohs(header.type), ntohs(header.requestId), data, length)); enterReceiveLoop(); } |