Move all socket handling into RemotePeer
authorManuel Nickschas <sputnick@quassel-irc.org>
Sun, 16 Feb 2014 16:29:28 +0000 (17:29 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 16 Feb 2014 16:29:28 +0000 (17:29 +0100)
commitb2169e5f4cbd3ce724c4808b62ddc2b8941219a5
tree1ea2f4c7b2dee77dfd9912b9ddbf8a46a0fc544c
parent02cfb595a6b78faf332ddbe2d7b997eb0e0293fb
Move all socket handling into RemotePeer

Previously we had the RemotePeer subclasses reading from and writing to
the socket themselves, resulting in code duplication and also making it
hard to have a single point for implementing compression support later.

We assume that any protocol we may come up with will send the size of
a datagram followed by the datagram itself, thus there's no need to
implement that part in the individual peers. And if we ever come up
with something else, we can always make some methods virtual and
override them for the special case.

We avoid using QDataStream in RemotePeer, as we are only reading/writing
QByteArrays anyway. That way, we can also replace the direct calls to
the socket by the layer implementing compression later, without it being
a proper QIODevice.
src/common/protocols/datastream/datastreampeer.cpp
src/common/protocols/datastream/datastreampeer.h
src/common/protocols/legacy/legacypeer.cpp
src/common/protocols/legacy/legacypeer.h
src/common/remotepeer.cpp
src/common/remotepeer.h