mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-22 15:48:22 +00:00
Many tweaks to stream memory allocation, including but not limited to streams now are shared_ptrs.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
#define _EQSTREAMFACTORY_H
|
||||
|
||||
#include <memory>
|
||||
#include <queue>
|
||||
#include <map>
|
||||
|
||||
@@ -26,10 +27,10 @@ class EQStreamFactory : private Timeoutable {
|
||||
|
||||
EQStreamType StreamType;
|
||||
|
||||
std::queue<EQStream *> NewStreams;
|
||||
std::queue<std::shared_ptr<EQStream>> NewStreams;
|
||||
Mutex MNewStreams;
|
||||
|
||||
std::map<std::pair<uint32, uint16>,EQStream *> Streams;
|
||||
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>> Streams;
|
||||
Mutex MStreams;
|
||||
|
||||
virtual void CheckTimeout();
|
||||
@@ -42,8 +43,8 @@ class EQStreamFactory : private Timeoutable {
|
||||
EQStreamFactory(EQStreamType type, uint32 timeout = 135000) : Timeoutable(5000), stream_timeout(timeout) { ReaderRunning=false; WriterRunning=false; StreamType=type; sock=-1; }
|
||||
EQStreamFactory(EQStreamType type, int port, uint32 timeout = 135000);
|
||||
|
||||
EQStream *Pop();
|
||||
void Push(EQStream *s);
|
||||
std::shared_ptr<EQStream> Pop();
|
||||
void Push(std::shared_ptr<EQStream> s);
|
||||
|
||||
bool Open();
|
||||
bool Open(unsigned long port) { Port=port; return Open(); }
|
||||
|
||||
Reference in New Issue
Block a user