mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 17:20:12 +02:00
Use congestion control on server.
This commit is contained in:
parent
5636171836
commit
b6570dc4ee
5 changed files with 24 additions and 8 deletions
|
@ -109,10 +109,7 @@ void MetavoxelSession::update() {
|
|||
}
|
||||
// if we're sending a reliable delta, wait until it's acknowledged
|
||||
if (_reliableDeltaChannel) {
|
||||
Bitstream& out = _sequencer.startPacket();
|
||||
MetavoxelDeltaPendingMessage msg = { _reliableDeltaID };
|
||||
out << QVariant::fromValue(msg);
|
||||
_sequencer.endPacket();
|
||||
sendPacketGroup();
|
||||
return;
|
||||
}
|
||||
Bitstream& out = _sequencer.startPacket();
|
||||
|
@ -143,6 +140,9 @@ void MetavoxelSession::update() {
|
|||
} else {
|
||||
_sequencer.endPacket();
|
||||
}
|
||||
|
||||
// perhaps send additional packets to fill out the group
|
||||
sendPacketGroup(1);
|
||||
}
|
||||
|
||||
void MetavoxelSession::handleMessage(const QVariant& message, Bitstream& in) {
|
||||
|
@ -179,3 +179,17 @@ void MetavoxelSession::checkReliableDeltaReceived() {
|
|||
_reliableDeltaData = MetavoxelData();
|
||||
_reliableDeltaChannel = NULL;
|
||||
}
|
||||
|
||||
void MetavoxelSession::sendPacketGroup(int alreadySent) {
|
||||
int additionalPackets = _sequencer.notePacketGroup() - alreadySent;
|
||||
for (int i = 0; i < additionalPackets; i++) {
|
||||
Bitstream& out = _sequencer.startPacket();
|
||||
if (_reliableDeltaChannel) {
|
||||
MetavoxelDeltaPendingMessage msg = { _reliableDeltaID };
|
||||
out << QVariant::fromValue(msg);
|
||||
} else {
|
||||
out << QVariant();
|
||||
}
|
||||
_sequencer.endPacket();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,6 +74,8 @@ private slots:
|
|||
|
||||
private:
|
||||
|
||||
void sendPacketGroup(int alreadySent = 0);
|
||||
|
||||
MetavoxelServer* _server;
|
||||
|
||||
MetavoxelLOD _lod;
|
||||
|
|
|
@ -79,7 +79,7 @@ ReliableChannel* DatagramSequencer::getReliableInputChannel(int index) {
|
|||
return channel;
|
||||
}
|
||||
|
||||
int DatagramSequencer::startPacketGroup(int desiredPackets) {
|
||||
int DatagramSequencer::notePacketGroup(int desiredPackets) {
|
||||
// figure out how much data we have enqueued and increase the number of packets desired
|
||||
int totalAvailable = 0;
|
||||
foreach (ReliableChannel* channel, _reliableOutputChannels) {
|
||||
|
|
|
@ -108,10 +108,10 @@ public:
|
|||
/// Returns the intput channel at the specified index, creating it if necessary.
|
||||
ReliableChannel* getReliableInputChannel(int index = 0);
|
||||
|
||||
/// Starts a packet group.
|
||||
/// Notes that we're sending a group of packets.
|
||||
/// \param desiredPackets the number of packets we'd like to write in the group
|
||||
/// \return the number of packets to write in the group
|
||||
int startPacketGroup(int desiredPackets = 1);
|
||||
int notePacketGroup(int desiredPackets = 1);
|
||||
|
||||
/// Starts a new packet for transmission.
|
||||
/// \return a reference to the Bitstream to use for writing to the packet
|
||||
|
|
|
@ -859,7 +859,7 @@ bool TestEndpoint::simulate(int iterationNumber) {
|
|||
bytesReceived += datagram.size();
|
||||
_remainingPipelineCapacity += datagram.size();
|
||||
}
|
||||
int packetCount = _sequencer.startPacketGroup();
|
||||
int packetCount = _sequencer.notePacketGroup();
|
||||
groupsSent++;
|
||||
maxPacketsPerGroup = qMax(maxPacketsPerGroup, packetCount);
|
||||
for (int i = 0; i < packetCount; i++) {
|
||||
|
|
Loading…
Reference in a new issue