aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules/dcc
diff options
context:
space:
mode:
authorGravatar Fabio Bas2009-09-03 08:57:21 +0000
committerGravatar Fabio Bas2009-09-03 08:57:21 +0000
commit5a2a25f4991d0a0d76dd6304cbe46b5d337b0cfb (patch)
tree2389c854f9617052ec04a45551a39e5f17df4d30 /src/modules/dcc
parentreverting r3161 since qt4 is not able to handle correctly frame caption anymo... (diff)
downloadKVIrc-5a2a25f4991d0a0d76dd6304cbe46b5d337b0cfb.tar.gz
KVIrc-5a2a25f4991d0a0d76dd6304cbe46b5d337b0cfb.tar.bz2
KVIrc-5a2a25f4991d0a0d76dd6304cbe46b5d337b0cfb.zip
fix for #551
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3473 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/dcc')
-rw-r--r--src/modules/dcc/send.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/modules/dcc/send.cpp b/src/modules/dcc/send.cpp
index fbf900c90..baab4457f 100644
--- a/src/modules/dcc/send.cpp
+++ b/src/modules/dcc/send.cpp
@@ -471,6 +471,11 @@ void KviDccSendThread::updateStats()
m_pMutex->unlock();
}
+union _ack_buffer {
+ char cAckBuffer[4];
+ quint32 i32AckBuffer;
+};
+
void KviDccSendThread::run()
{
m_pTimeInterval->mark();
@@ -481,7 +486,7 @@ void KviDccSendThread::run()
m_iTotalSentBytes = 0;
m_iInstantSentBytes = 0;
int iFailedSelects = 0;
- char ackbuffer[4];
+ _ack_buffer ackbuffer;
int iBytesInAckBuffer = 0;
quint32 iLastAck = 0;
@@ -541,13 +546,13 @@ void KviDccSendThread::run()
if(!m_pOpt->bNoAcks)
{
int iAckBytesToRead = 4 - iBytesInAckBuffer;
- int readLen = kvi_socket_recv(m_fd,(void *)(ackbuffer + iBytesInAckBuffer),iAckBytesToRead);
+ int readLen = kvi_socket_recv(m_fd,(void *)(ackbuffer.cAckBuffer + iBytesInAckBuffer),iAckBytesToRead);
if(readLen > 0)
{
iBytesInAckBuffer += readLen;
if(iBytesInAckBuffer == 4)
{
- quint32 iNewAck = ntohl(*((quint32 *)ackbuffer));
+ quint32 iNewAck = ntohl(ackbuffer.i32AckBuffer);
if((iNewAck > pFile->pos()) || (iNewAck < iLastAck))
{
// the peer is drunk or is trying to fool us