From 52fada92f5e502f77ad19486a98b896fdf667d85 Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 27 Dec 2015 05:22:52 +0100 Subject: fix fragmentation header parsing --- sapsocket.cc | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'sapsocket.cc') diff --git a/sapsocket.cc b/sapsocket.cc index cc6ea2e..c8219a9 100644 --- a/sapsocket.cc +++ b/sapsocket.cc @@ -7,7 +7,7 @@ #include "sapsocket.h" #define DELAYED_ACK_TIME 1000 -#define RESEND_TIME 10000 +#define RESEND_TIME 5000 #define WINDOW_SIZE_MSGS 10 SAPSocket::SAPSocket(SAPConnection *conn, int sessionId, const SAPChannelInfo &chanInfo) : @@ -92,7 +92,10 @@ void SAPSocket::setOpen(bool open) void SAPSocket::acceptIncomingData(const QByteArray &data) { - SAProtocol::DataFrame frame = SAProtocol::unpackDataFrame(data, isWithSeqNum()); + SAProtocol::DataFrame frame = SAProtocol::unpackDataFrame(data, + isReliable(), supportsFragmentation()); + + qDebug() << data.mid(0, 6).toHex() << frame.data.mid(0, 6).toHex(); if (isReliable()) { quint16 expectedSeqNum = _inLastSeqNum + 1; @@ -167,10 +170,10 @@ bool SAPSocket::isReliable() const return _info.qosType() == SAPChannelInfo::QoSReliabilityEnable; } -bool SAPSocket::isWithSeqNum() const +bool SAPSocket::supportsFragmentation() const { - return _info.qosType() == SAPChannelInfo::QoSReliabilityDisable || - _info.qosType() == SAPChannelInfo::QoSReliabilityEnable; + return _info.qosType() == SAPChannelInfo::QoSReliabilityEnable || + _info.qosType() == SAPChannelInfo::QoSReliabilityDisable; } void SAPSocket::sendBlockAck(int seqNum) @@ -184,9 +187,10 @@ void SAPSocket::sendBlockAck(int seqNum) void SAPSocket::sendPacket(int seqNum, const QByteArray &data) { SAProtocol::DataFrame frame; - frame.withSeqNum = isWithSeqNum(); + frame.withSeqNum = isReliable(); frame.seqNum = seqNum; - frame.unk_1 = 0; // Is this related to fragmentation? + frame.withFragStatus = supportsFragmentation(); + frame.fragStatus = SAProtocol::FragmentNone; frame.data = data; peer()->writeDataToSession(_sessionId, SAProtocol::packDataFrame(frame)); } -- cgit v1.2.3