[wpdev-commits] wolfpack/network asyncnetio.cpp,1.50,1.51 uosocket.cpp,1.413,1.414
Brought to you by:
rip,
thiagocorrea
From: Sebastian H. <dar...@us...> - 2004-09-19 04:00:47
|
Update of /cvsroot/wpdev/wolfpack/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28823 Modified Files: asyncnetio.cpp uosocket.cpp Log Message: Network fixes Index: uosocket.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/uosocket.cpp,v retrieving revision 1.413 retrieving revision 1.414 diff -C2 -d -r1.413 -r1.414 *** uosocket.cpp 18 Sep 2004 04:26:26 -0000 1.413 --- uosocket.cpp 19 Sep 2004 04:00:35 -0000 1.414 *************** *** 169,173 **** // Once send, flush if in Debug mode #if defined(_DEBUG) ! Network::instance()->netIo()->flush( _socket ); #endif } --- 169,173 ---- // Once send, flush if in Debug mode #if defined(_DEBUG) ! //Network::instance()->netIo()->flush( _socket ); #endif } Index: asyncnetio.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/asyncnetio.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** asyncnetio.cpp 19 Aug 2004 01:22:55 -0000 1.50 --- asyncnetio.cpp 19 Sep 2004 04:00:35 -0000 1.51 *************** *** 112,116 **** QSocketDevice* socket; // connection socket ! QPtrList<QByteArray> rba, wba; // list of read/write bufs Q_ULONG rsize, wsize; // read/write total buf size Q_ULONG rindex, windex; // read/write index --- 112,117 ---- QSocketDevice* socket; // connection socket ! // ewba is the encrypted write buffer ! QPtrList<QByteArray> rba, wba, ewba; // list of read/write bufs Q_ULONG rsize, wsize; // read/write total buf size Q_ULONG rindex, windex; // read/write index *************** *** 139,142 **** --- 140,144 ---- rba.setAutoDelete( TRUE ); wba.setAutoDelete( TRUE ); + ewba.setAutoDelete( TRUE ); } *************** *** 275,283 **** for ( ; ; ) { ! QByteArray* a = wba.first(); if ( windex + nbytes >= a->size() ) { nbytes -= a->size() - windex; ! wba.remove(); windex = 0; if ( nbytes == 0 ) --- 277,285 ---- for ( ; ; ) { ! QByteArray* a = ewba.first(); if ( windex + nbytes >= a->size() ) { nbytes -= a->size() - windex; ! ewba.remove(); windex = 0; if ( nbytes == 0 ) *************** *** 671,679 **** return; // Before we continue, we should guarantee no one writes packets to the buffer. QMutexLocker lock( &d->wmutex ); while ( !osBufferFull && d->wsize > 0 ) { ! QByteArray* a = d->wba.first(); int nwritten; int i = 0; --- 673,694 ---- return; + // Encrypt new packets + QByteArray *p = d->wba.first(); + while (p) { + // Encrypt the outgoing buffer + if ( d->encryption ) + d->encryption->serverEncrypt( p->data(), p->size() ); + d->ewba.append(p); + p = d->wba.next(); + } + d->wba.setAutoDelete(FALSE); + d->wba.clear(); + d->wba.setAutoDelete(TRUE); + // Before we continue, we should guarantee no one writes packets to the buffer. QMutexLocker lock( &d->wmutex ); while ( !osBufferFull && d->wsize > 0 ) { ! QByteArray* a = d->ewba.first(); int nwritten; int i = 0; *************** *** 697,708 **** j = 0; i += s; ! a = d->wba.next(); s = a ? a->size() : 0; } - // Encrypt the outgoing buffer - if ( d->encryption ) - d->encryption->serverEncrypt( out.data(), i ); - nwritten = d->socket->writeBlock( out.data(), i ); } --- 712,719 ---- j = 0; i += s; ! a = d->ewba.next(); s = a ? a->size() : 0; } nwritten = d->socket->writeBlock( out.data(), i ); } *************** *** 712,723 **** i = a->size() - d->windex; - // Encrypt the outgoing buffer - if ( d->encryption ) - d->encryption->serverEncrypt( a->data() + d->windex, i ); - nwritten = d->socket->writeBlock( a->data() + d->windex, i ); } ! if ( nwritten ) { if ( d->consumeWriteBuf( nwritten ) ) --- 723,730 ---- i = a->size() - d->windex; nwritten = d->socket->writeBlock( a->data() + d->windex, i ); } ! if ( nwritten > 0 ) { if ( d->consumeWriteBuf( nwritten ) ) |