protobuf client->server communication almost working

This commit is contained in:
Max-Wilhelm Bruker 2011-12-18 18:35:14 +01:00
parent 4eb9dfc5bf
commit 314f17091d
96 changed files with 1633 additions and 860 deletions

View file

@ -37,15 +37,7 @@ HEADERS += src/main.h \
../common/server_game.h \
../common/server_player.h \
../common/server_protocolhandler.h \
../common/server_arrowtarget.h \
../common/pb/commands.pb.h \
../common/pb/color.pb.h \
../common/pb/move_card_to_zone.pb.h \
../common/pb/game_commands.pb.h \
../common/pb/room_commands.pb.h \
../common/pb/session_commands.pb.h \
../common/pb/moderator_commands.pb.h \
../common/pb/admin_commands.pb.h
../common/server_arrowtarget.h
SOURCES += src/main.cpp \
@ -68,13 +60,7 @@ SOURCES += src/main.cpp \
../common/server_room.cpp \
../common/server_game.cpp \
../common/server_player.cpp \
../common/server_protocolhandler.cpp \
../common/pb/commands.pb.cc \
../common/pb/color.pb.cc \
../common/pb/move_card_to_zone.pb.cc \
../common/pb/game_commands.pb.cc \
../common/pb/room_commands.pb.cc \
../common/pb/session_commands.pb.cc \
../common/pb/moderator_commands.pb.cc \
../common/pb/admin_commands.pb.cc
../common/server_protocolhandler.cpp
include ( ../pb_headers )
include ( ../pb_sources )

View file

@ -33,11 +33,17 @@
#include "server_logger.h"
#include "pb/commands.pb.h"
#include "pb/command_deck_upload.pb.h"
#include "pb/command_deck_download.pb.h"
#include "pb/command_deck_new_dir.pb.h"
#include "pb/command_deck_del_dir.pb.h"
#include "pb/command_deck_del.pb.h"
#include <string>
#include <iostream>
ServerSocketInterface::ServerSocketInterface(Servatrice *_server, QTcpSocket *_socket, QObject *parent)
: Server_ProtocolHandler(_server, parent), servatrice(_server), socket(_socket), topLevelItem(0), compressionSupport(false)
: Server_ProtocolHandler(_server, parent), servatrice(_server), socket(_socket), topLevelItem(0), compressionSupport(false), messageInProgress(false)
{
xmlWriter = new QXmlStreamWriter(&xmlBuffer);
xmlReader = new QXmlStreamReader;
@ -107,6 +113,7 @@ void ServerSocketInterface::readClient()
CommandContainer *newCommandContainer = new CommandContainer;
newCommandContainer->ParseFromArray(inputBuffer.data(), messageLength);
logger->logMessage(QString::fromStdString(newCommandContainer->ShortDebugString()), this);
inputBuffer.remove(0, messageLength);
messageInProgress = false;