Commit 085ff10d authored by rna's avatar rna

Separate pacing wait from cwnd wait.

parent ba811c2c
......@@ -82,29 +82,28 @@ static bool send_packet(PrrtSocket *sock_ptr, PrrtPacket *packet) {
if (sock_ptr->pacingEnabled && sock_ptr->nextSendTime != 0) {
debug(DEBUG_DATATRANSMITTER, "About to check for pacing.");
prrtTimeDifference_t diff = 0;
int64_t space;
do {
prrtTimeDifference_t now = (prrtTimeDifference_t) PrrtClock_get_current_time_us();
diff = ((prrtTimeDifference_t) sock_ptr->nextSendTime) - now;
int64_t cwnd = (int64_t) PrrtReceiver_getBBRCwnd(sock_ptr->receiver);
int64_t pipe = (int64_t) PrrtReceiver_get_pipe(sock_ptr->receiver);
space = cwnd - pipe;
debug(DEBUG_DATATRANSMITTER, "C: %u, P: %u, S: %d", cwnd, pipe, space);
if(space < 0) {
space = 0;
diff = 10;
}
if (diff > 0 || payloadLength > space) {
if (diff > 0) {
debug(DEBUG_DATATRANSMITTER, "S: %u, Pacing for %d (%u).", packet->sequenceNumber, diff, now);
debug(DEBUG_DATATRANSMITTER, "P: %u, S: %d, N: %d, %u", payloadLength, space, diff, sock_ptr->nextSendTime);
usleep_nano((uint32_t) diff);
}
//PrrtReceiver_check_rto(sock_ptr->receiver, packet->sequenceNumber, PrrtPacket_type(packet));
} while (diff > 0 || payloadLength > space);
} while (diff > 0);
} else {
usleep_nano(1);
}
int64_t space, cwnd, pipe;
do {
cwnd = (int64_t) PrrtReceiver_getBBRCwnd(sock_ptr->receiver);
pipe = (int64_t) PrrtReceiver_get_pipe(sock_ptr->receiver);
space = cwnd - pipe;
usleep_nano(100);
//PrrtReceiver_check_rto(sock_ptr->receiver, packet->sequenceNumber, PrrtPacket_type(packet));
} while(space < sock_ptr->mtu);
prrtTimestamp_t now = PrrtClock_get_current_time_us();
if (sock_ptr->pacingEnabled) {
double pacing_rate = PrrtReceiver_getBBRPacingRate(sock_ptr->receiver);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment