mirror of
https://github.com/minetest/minetest.git
synced 2024-11-27 01:53:45 +01:00
Nerf protocol window sizes
This commit is contained in:
parent
b93cce11d8
commit
722c0044b1
@ -751,6 +751,7 @@ void Channel::UpdateTimers(float dtime)
|
||||
packet_too_late = current_packet_too_late;
|
||||
packets_successful = current_packet_successful;
|
||||
|
||||
// has half the window even been used?
|
||||
if (current_bytes_transfered > (unsigned int) (m_window_size*512/2)) {
|
||||
reasonable_amount_of_data_transmitted = true;
|
||||
}
|
||||
|
@ -329,15 +329,24 @@ private:
|
||||
static ConnectionCommandPtr create(ConnectionCommandType type);
|
||||
};
|
||||
|
||||
/* maximum window size to use, 0xFFFF is theoretical maximum. don't think about
|
||||
/*
|
||||
* Window sizes to use, in packets (not bytes!).
|
||||
* 0xFFFF is theoretical maximum. don't think about
|
||||
* touching it, the less you're away from it the more likely data corruption
|
||||
* will occur
|
||||
*
|
||||
* Note: window sizes directly translate to maximum possible throughput, e.g.
|
||||
* (2048 * 512 bytes) / 33ms = 15 MiB/s
|
||||
*/
|
||||
|
||||
// Due to backwards compatibility we have different window sizes for what we'll
|
||||
// accept from peers vs. what we use for sending.
|
||||
#define MAX_RELIABLE_WINDOW_SIZE 0x8000
|
||||
#define MAX_RELIABLE_WINDOW_SIZE_SEND 2048
|
||||
/* starting value for window size */
|
||||
#define START_RELIABLE_WINDOW_SIZE 0x400
|
||||
#define START_RELIABLE_WINDOW_SIZE 64
|
||||
/* minimum value for window size */
|
||||
#define MIN_RELIABLE_WINDOW_SIZE 0x40
|
||||
#define MIN_RELIABLE_WINDOW_SIZE 32
|
||||
|
||||
class Channel
|
||||
{
|
||||
@ -405,7 +414,7 @@ public:
|
||||
|
||||
void setWindowSize(long size)
|
||||
{
|
||||
m_window_size = (u16)rangelim(size, MIN_RELIABLE_WINDOW_SIZE, MAX_RELIABLE_WINDOW_SIZE);
|
||||
m_window_size = (u16)rangelim(size, MIN_RELIABLE_WINDOW_SIZE, MAX_RELIABLE_WINDOW_SIZE_SEND);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -317,6 +317,7 @@ void ConnectionSendThread::sendAsPacketReliable(BufferedPacketPtr &p, Channel *c
|
||||
channel->outgoing_reliables_sent.insert(p,
|
||||
(channel->readOutgoingSequenceNumber() - MAX_RELIABLE_WINDOW_SIZE)
|
||||
% (MAX_RELIABLE_WINDOW_SIZE + 1));
|
||||
// wtf is this calculation?? ^
|
||||
}
|
||||
catch (AlreadyExistsException &e) {
|
||||
LOG(derr_con << m_connection->getDesc()
|
||||
|
Loading…
Reference in New Issue
Block a user