@@ -60,14 +60,6 @@ static inline float CALC_DTIME(u64 lasttime, u64 curtime)
60
60
return MYMAX (MYMIN (value,0.1 ),0.0 );
61
61
}
62
62
63
- /* maximum window size to use, 0xFFFF is theoretical maximum don't think about
64
- * touching it, the less you're away from it the more likely data corruption
65
- * will occur
66
- */
67
- #define MAX_RELIABLE_WINDOW_SIZE 0x8000
68
- /* starting value for window size */
69
- #define MIN_RELIABLE_WINDOW_SIZE 0x40
70
-
71
63
#define MAX_UDP_PEERS 65535
72
64
73
65
#define PING_TIMEOUT 5.0
@@ -209,8 +201,6 @@ SharedBuffer<u8> makeReliablePacket(
209
201
ReliablePacketBuffer
210
202
*/
211
203
212
- ReliablePacketBuffer::ReliablePacketBuffer (): m_list_size(0 ) {}
213
-
214
204
void ReliablePacketBuffer::print ()
215
205
{
216
206
MutexAutoLock listlock (m_list_mutex);
@@ -577,36 +567,6 @@ void IncomingSplitBuffer::removeUnreliableTimedOuts(float dtime, float timeout)
577
567
Channel
578
568
*/
579
569
580
- Channel::Channel () :
581
- window_size (MIN_RELIABLE_WINDOW_SIZE),
582
- next_incoming_seqnum (SEQNUM_INITIAL),
583
- next_outgoing_seqnum (SEQNUM_INITIAL),
584
- next_outgoing_split_seqnum (SEQNUM_INITIAL),
585
- current_packet_loss (0 ),
586
- current_packet_too_late (0 ),
587
- current_packet_successfull (0 ),
588
- packet_loss_counter (0 ),
589
- current_bytes_transfered (0 ),
590
- current_bytes_received (0 ),
591
- current_bytes_lost (0 ),
592
- max_kbps (0.0 ),
593
- cur_kbps (0.0 ),
594
- avg_kbps (0.0 ),
595
- max_incoming_kbps (0.0 ),
596
- cur_incoming_kbps (0.0 ),
597
- avg_incoming_kbps (0.0 ),
598
- max_kbps_lost (0.0 ),
599
- cur_kbps_lost (0.0 ),
600
- avg_kbps_lost (0.0 ),
601
- bpm_counter (0.0 ),
602
- rate_samples (0 )
603
- {
604
- }
605
-
606
- Channel::~Channel ()
607
- {
608
- }
609
-
610
570
u16 Channel::readNextIncomingSeqNum ()
611
571
{
612
572
MutexAutoLock internal (m_internal_mutex);
@@ -849,40 +809,26 @@ void Channel::UpdateTimers(float dtime,bool legacy_peer)
849
809
Peer
850
810
*/
851
811
852
- PeerHelper::PeerHelper () :
853
- m_peer (0 )
854
- {}
855
-
856
812
PeerHelper::PeerHelper (Peer* peer) :
857
813
m_peer (peer)
858
814
{
859
- if (peer != NULL )
860
- {
861
- if (!peer->IncUseCount ())
862
- {
863
- m_peer = 0 ;
864
- }
865
- }
815
+ if (peer && !peer->IncUseCount ())
816
+ m_peer = nullptr ;
866
817
}
867
818
868
819
PeerHelper::~PeerHelper ()
869
820
{
870
- if (m_peer != 0 )
821
+ if (m_peer)
871
822
m_peer->DecUseCount ();
872
823
873
- m_peer = 0 ;
824
+ m_peer = nullptr ;
874
825
}
875
826
876
827
PeerHelper& PeerHelper::operator =(Peer* peer)
877
828
{
878
829
m_peer = peer;
879
- if (peer != NULL )
880
- {
881
- if (!peer->IncUseCount ())
882
- {
883
- m_peer = 0 ;
884
- }
885
- }
830
+ if (peer && !peer->IncUseCount ())
831
+ m_peer = nullptr ;
886
832
return *this ;
887
833
}
888
834
@@ -909,8 +855,7 @@ bool Peer::IncUseCount()
909
855
{
910
856
MutexAutoLock lock (m_exclusive_access_mutex);
911
857
912
- if (!m_pending_deletion)
913
- {
858
+ if (!m_pending_deletion) {
914
859
this ->m_usage ++;
915
860
return true ;
916
861
}
@@ -1014,10 +959,7 @@ void Peer::Drop()
1014
959
}
1015
960
1016
961
UDPPeer::UDPPeer (u16 a_id, Address a_address, Connection* connection) :
1017
- Peer (a_address,a_id,connection),
1018
- m_pending_disconnect (false ),
1019
- resend_timeout (0.5 ),
1020
- m_legacy_peer (true )
962
+ Peer (a_address,a_id,connection)
1021
963
{
1022
964
}
1023
965
@@ -1261,12 +1203,9 @@ SharedBuffer<u8> UDPPeer::addSpiltPacket(u8 channel,
1261
1203
ConnectionSendThread::ConnectionSendThread (unsigned int max_packet_size,
1262
1204
float timeout) :
1263
1205
Thread (" ConnectionSend" ),
1264
- m_connection (NULL ),
1265
1206
m_max_packet_size (max_packet_size),
1266
1207
m_timeout (timeout),
1267
- m_max_commands_per_iteration (1 ),
1268
- m_max_data_packets_per_iteration (g_settings->getU16 (" max_packets_per_iteration" )),
1269
- m_max_packets_requeued(256 )
1208
+ m_max_data_packets_per_iteration (g_settings->getU16 (" max_packets_per_iteration" ))
1270
1209
{
1271
1210
}
1272
1211
@@ -2031,8 +1970,7 @@ void ConnectionSendThread::sendAsPacket(u16 peer_id, u8 channelnum,
2031
1970
}
2032
1971
2033
1972
ConnectionReceiveThread::ConnectionReceiveThread (unsigned int max_packet_size) :
2034
- Thread(" ConnectionReceive" ),
2035
- m_connection(NULL )
1973
+ Thread(" ConnectionReceive" )
2036
1974
{
2037
1975
}
2038
1976
@@ -2676,17 +2614,10 @@ SharedBuffer<u8> ConnectionReceiveThread::processPacket(Channel *channel,
2676
2614
Connection::Connection (u32 protocol_id, u32 max_packet_size, float timeout,
2677
2615
bool ipv6, PeerHandler *peerhandler) :
2678
2616
m_udpSocket(ipv6),
2679
- m_command_queue(),
2680
- m_event_queue(),
2681
- m_peer_id(0 ),
2682
2617
m_protocol_id(protocol_id),
2683
2618
m_sendThread(max_packet_size, timeout),
2684
2619
m_receiveThread(max_packet_size),
2685
- m_info_mutex(),
2686
- m_bc_peerhandler(peerhandler),
2687
- m_bc_receive_timeout(0 ),
2688
- m_shutting_down(false ),
2689
- m_next_remote_peer_id(2 )
2620
+ m_bc_peerhandler(peerhandler)
2690
2621
2691
2622
{
2692
2623
m_udpSocket.setTimeoutMs (5 );
0 commit comments