Update of /cvsroot/wpdev/wolfpack/network
In directory sc8-pr-cvs1:/tmp/cvs-serv12900/network
Modified Files:
asyncnetio.cpp asyncnetio.h listener.cpp uosocket.cpp
Log Message:
reworked Preferences class, nearly complete rewrite.
some fixes, and some cosmetic changes.
Index: asyncnetio.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/network/asyncnetio.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** asyncnetio.cpp 3 Sep 2003 20:58:17 -0000 1.34
--- asyncnetio.cpp 19 Sep 2003 20:41:08 -0000 1.35
***************
*** 34,37 ****
--- 34,38 ----
#include "../srvparams.h"
#include "../globals.h"
+ #include "../basics.h"
// Library Includes
***************
*** 40,43 ****
--- 41,46 ----
#include <qmap.h>
+ #include <algorithm>
+
#undef CONST
***************
*** 115,121 ****
Q_ULONG rindex, windex; // read/write index
QMutex wmutex; // write mutex
! bool skippedUOHeader; // Skip crypt key junk
! std::deque<cUOPacket*>* packets; // Complete UOPackets
QMutex packetsMutex;
QMutex cryptMutex;
--- 118,124 ----
Q_ULONG rindex, windex; // read/write index
QMutex wmutex; // write mutex
! bool skippedUOHeader; // Skip crypt key junk
! std::deque<cUOPacket*> packets; // Complete UOPackets
QMutex packetsMutex;
QMutex cryptMutex;
***************
*** 139,154 ****
rba.setAutoDelete( TRUE );
wba.setAutoDelete( TRUE );
- packets = new std::deque<cUOPacket*>;
}
cAsyncNetIOPrivate::~cAsyncNetIOPrivate()
{
! for ( uint i = 0; i < packets->size(); ++i )
{
/// QMutexLocker lock( &packetsMutex ); I think it's safe not to lock here.
! delete packets->front();
! packets->pop_front();
}
- delete packets;
delete encryption;
}
--- 142,155 ----
rba.setAutoDelete( TRUE );
wba.setAutoDelete( TRUE );
}
cAsyncNetIOPrivate::~cAsyncNetIOPrivate()
{
! for ( uint i = 0; i < packets.size(); ++i )
{
/// QMutexLocker lock( &packetsMutex ); I think it's safe not to lock here.
! delete packets.front();
! packets.pop_front();
}
delete encryption;
}
***************
*** 345,348 ****
--- 346,359 ----
/*!
+ Frees allocated buffer memory for the sockets
+ */
+ cAsyncNetIO::~cAsyncNetIO() throw()
+ {
+ QMap<QSocketDevice*, cAsyncNetIOPrivate*>::iterator it = buffers.begin();
+ for (; it != buffers.end(); ++it)
+ delete it.data();
+ }
+
+ /*!
Registers a \a socket for asyncronous services.
\a login determines whether the connection has been established to
***************
*** 596,600 ****
d->socket->close();
QMutexLocker lock(&d->packetsMutex);
! d->packets->push_back( packet );
}
else
--- 607,611 ----
d->socket->close();
QMutexLocker lock(&d->packetsMutex);
! d->packets.push_back( packet );
}
else
***************
*** 628,632 ****
d->socket->close();
QMutexLocker lock(&d->packetsMutex);
! d->packets->push_back( packet );
}
}
--- 639,643 ----
d->socket->close();
QMutexLocker lock(&d->packetsMutex);
! d->packets.push_back( packet );
}
}
***************
*** 717,725 ****
{
iterator it = buffers.find( socket );
! if ( it.data()->packets->size() )
{
QMutexLocker lock(&(it.data()->packetsMutex));
! cUOPacket* p = it.data()->packets->front();
! it.data()->packets->pop_front();
return p;
}
--- 728,736 ----
{
iterator it = buffers.find( socket );
! if ( it.data()->packets.size() )
{
QMutexLocker lock(&(it.data()->packetsMutex));
! cUOPacket* p = it.data()->packets.front();
! it.data()->packets.pop_front();
return p;
}
Index: asyncnetio.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/network/asyncnetio.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** asyncnetio.h 12 Jun 2003 02:19:38 -0000 1.13
--- asyncnetio.h 19 Sep 2003 20:41:08 -0000 1.14
***************
*** 55,59 ****
public:
cAsyncNetIO() : canceled_(false) {}
! ~cAsyncNetIO() throw() {}
bool registerSocket(QSocketDevice*, bool loginSocket);
--- 55,59 ----
public:
cAsyncNetIO() : canceled_(false) {}
! ~cAsyncNetIO() throw();
bool registerSocket(QSocketDevice*, bool loginSocket);
Index: listener.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/network/listener.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** listener.cpp 12 Jun 2003 02:19:38 -0000 1.13
--- listener.cpp 19 Sep 2003 20:41:08 -0000 1.14
***************
*** 30,33 ****
--- 30,36 ----
#include "listener.h"
+ #include "../basics.h"
+
+ #include <algorithm>
/*****************************************************************************
***************
*** 63,66 ****
--- 66,70 ----
cListener::~cListener() throw()
{
+ std::for_each( readyConnections.begin(), readyConnections.end(), destroy<QSocketDevice*>() );
}
Index: uosocket.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/network/uosocket.cpp,v
retrieving revision 1.292
retrieving revision 1.293
diff -C2 -d -r1.292 -r1.293
*** uosocket.cpp 16 Sep 2003 18:15:42 -0000 1.292
--- uosocket.cpp 19 Sep 2003 20:41:08 -0000 1.293
***************
*** 108,111 ****
--- 108,114 ----
}
+ #include <functional>
+
+
/*!
Destructs the cUOSocket instance.
|