X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fconnection.h;h=f5cddcbf4d7b74158e06722a471b1014cb489872;hb=8aa930f28e69f3518831500022988ca2a4b6985d;hp=e03c7983f77516bebf42dbc73322835dcbb006b5;hpb=d0ea6f9920d30f46d1f5d44e8823a8d932f9f29d;p=dragonfireclient.git diff --git a/src/connection.h b/src/connection.h index e03c7983f..f5cddcbf4 100644 --- a/src/connection.h +++ b/src/connection.h @@ -1,6 +1,6 @@ /* -Minetest-c55 -Copyright (C) 2010 celeron55, Perttu Ahola +Minetest +Copyright (C) 2013 celeron55, Perttu Ahola This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef CONNECTION_HEADER #define CONNECTION_HEADER -#include "irrlichttypes.h" +#include "irrlichttypes_bloated.h" #include "socket.h" #include "exceptions.h" #include "constants.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 @@ class ReliablePacketBuffer 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 @@ class IncomingSplitBuffer private: // Key is seqnum - core::map m_buf; + std::map m_buf; }; class Connection; @@ -394,7 +397,11 @@ class Peer float m_max_packets_per_second; int m_num_sent; int m_max_num_sent; - + + // Updated from configuration by Connection + float congestion_control_aim_rtt; + float congestion_control_max_rate; + float congestion_control_min_rate; private: }; @@ -541,8 +548,8 @@ struct ConnectionCommand class Connection: public SimpleThread { public: - Connection(u32 protocol_id, u32 max_packet_size, float timeout); - Connection(u32 protocol_id, u32 max_packet_size, float timeout, + Connection(u32 protocol_id, u32 max_packet_size, float timeout, bool ipv6); + Connection(u32 protocol_id, u32 max_packet_size, float timeout, bool ipv6, PeerHandler *peerhandler); ~Connection(); void * Thread(); @@ -585,7 +592,7 @@ class Connection: public SimpleThread 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. @@ -615,7 +622,7 @@ class Connection: public SimpleThread UDPSocket m_socket; u16 m_peer_id; - core::map m_peers; + std::map m_peers; JMutex m_peers_mutex; // Backwards compatibility