From 6a1670dbc31cc0e44178bbd9ad34ff0d5981a060 Mon Sep 17 00:00:00 2001 From: Ilya Zhuravlev Date: Thu, 20 Dec 2012 21:19:49 +0400 Subject: Migrate to STL containers/algorithms. --- src/connection.h | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src/connection.h') diff --git a/src/connection.h b/src/connection.h index 05b1ca2e8..486cf331f 100644 --- a/src/connection.h +++ b/src/connection.h @@ -29,6 +29,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/thread.h" #include #include +#include +#include namespace con { @@ -142,14 +144,14 @@ SharedBuffer makeOriginalPacket( SharedBuffer data); // Split data in chunks and add TYPE_SPLIT headers to them -core::list > makeSplitPacket( +std::list > makeSplitPacket( SharedBuffer data, u32 chunksize_max, u16 seqnum); // Depending on size, make a TYPE_ORIGINAL or TYPE_SPLIT packet // Increments split_seqnum if a split packet is made -core::list > makeAutoSplitPacket( +std::list > makeAutoSplitPacket( SharedBuffer data, u32 chunksize_max, u16 &split_seqnum); @@ -167,7 +169,7 @@ struct IncomingSplitPacket reliable = false; } // Key is chunk number, value is data without headers - core::map > chunks; + std::map > chunks; u32 chunk_count; float time; // Seconds from adding bool reliable; // If true, isn't deleted on timeout @@ -268,12 +270,12 @@ with a buffer in the receiving and transmitting end. for fast access to the smallest one. */ -typedef core::list::Iterator RPBSearchResult; +typedef std::list::iterator RPBSearchResult; class ReliablePacketBuffer { public: - + ReliablePacketBuffer(); void print(); bool empty(); u32 size(); @@ -286,10 +288,11 @@ public: void incrementTimeouts(float dtime); void resetTimedOuts(float timeout); bool anyTotaltimeReached(float timeout); - core::list getTimedOuts(float timeout); + std::list getTimedOuts(float timeout); private: - core::list m_list; + std::list m_list; + u16 m_list_size; }; /* @@ -310,7 +313,7 @@ public: private: // Key is seqnum - core::map m_buf; + std::map m_buf; }; class Connection; @@ -589,7 +592,7 @@ private: void rawSend(const BufferedPacket &packet); Peer* getPeer(u16 peer_id); Peer* getPeerNoEx(u16 peer_id); - core::list getPeers(); + std::list getPeers(); bool getFromBuffers(u16 &peer_id, SharedBuffer &dst); // Returns next data from a buffer if possible // If found, returns true; if not, false. @@ -619,7 +622,7 @@ private: UDPSocket m_socket; u16 m_peer_id; - core::map m_peers; + std::map m_peers; JMutex m_peers_mutex; // Backwards compatibility -- cgit v1.2.3