Commit db6d95b3 authored by Andreas Schmidt's avatar Andreas Schmidt

Merge branch 'develop' into feature/congestionControl

parents c1f3364f ba373eae
Pipeline #2607 passed with stages
in 1 minute and 7 seconds
...@@ -285,7 +285,7 @@ void *receive_data_loop(void *ptr) { ...@@ -285,7 +285,7 @@ void *receive_data_loop(void *ptr) {
struct timespec packet_recv_timestamp; struct timespec packet_recv_timestamp;
uint64_t packet_recv_cyclestamp = 0; uint64_t packet_recv_cyclestamp = 0;
receive_from_socket(s, buffer, &n, &remote, &addrlen, &packet_recv_timestamp, &packet_recv_cyclestamp); receive_from_socket(s, buffer, &n, &remote, &addrlen, &packet_recv_timestamp, &packet_recv_cyclestamp);
if (!atomic_load_explicit(&s->closing, memory_order_acquire)) { if (atomic_load_explicit(&s->closing, memory_order_acquire)) {
break; break;
} }
......
...@@ -302,7 +302,6 @@ void PrrtReceiver_wait_for_space(PrrtReceiver *receiver) { ...@@ -302,7 +302,6 @@ void PrrtReceiver_wait_for_space(PrrtReceiver *receiver) {
pthread_cond_timedwait(&receiver->wait_for_space, &receiver->lock, &deadline); pthread_cond_timedwait(&receiver->wait_for_space, &receiver->lock, &deadline);
check(pthread_mutex_unlock(&receiver->lock) == 0, "Unlock failed."); check(pthread_mutex_unlock(&receiver->lock) == 0, "Unlock failed.");
return; return;
error: error:
PERROR("Mutex error.%s", ""); PERROR("Mutex error.%s", "");
return; return;
......
...@@ -46,27 +46,29 @@ PrrtPacket* PrrtInFlightPacketStore_get_first_packet_before(PrrtInFlightPacketSt ...@@ -46,27 +46,29 @@ PrrtPacket* PrrtInFlightPacketStore_get_first_packet_before(PrrtInFlightPacketSt
prrtByteCount_t PrrtInFlightPacketStore_remove_outstanding_packet(PrrtInFlightPacketStore *packetStore, BPTreeKey_t seqNum) prrtByteCount_t PrrtInFlightPacketStore_remove_outstanding_packet(PrrtInFlightPacketStore *packetStore, BPTreeKey_t seqNum)
{ {
prrtByteCount_t lostBytes = 0; prrtByteCount_t lostBytes = 0;
PrrtPacket* value = (PrrtPacket*) BPTree_get(packetStore->outstandingPackets, seqNum); PrrtPacket* outstanding_packet = (PrrtPacket*) BPTree_get(packetStore->outstandingPackets, seqNum);
PrrtPacket_destroy(value); if(outstanding_packet != NULL) {
packetStore->outstandingPackets = BPTree_delete(packetStore->outstandingPackets, seqNum); packetStore->outstandingPackets = BPTree_delete(packetStore->outstandingPackets, seqNum);
packetStore->packetQueueSize--; packetStore->packetQueueSize--;
// TODO: Cleanup and loss marking. Make this more approriate with a "timeout". // TODO: Cleanup and loss marking. Make this more approriate with a "timeout".
List *packetStateList = List_create(); List *packetStateList = List_create();
if(seqNum >= SEQNO_SPACE/2) { if(seqNum >= SEQNO_SPACE/2) {
BPTree_get_range(packetStore->outstandingPackets, packetStateList, seqNum - (SEQNO_SPACE / 2), seqNum - 1); BPTree_get_range(packetStore->outstandingPackets, packetStateList, seqNum - (SEQNO_SPACE / 2), seqNum - 1);
} else { } else {
BPTree_get_range(packetStore->outstandingPackets, packetStateList, 0, seqNum - 1); BPTree_get_range(packetStore->outstandingPackets, packetStateList, 0, seqNum - 1);
BPTree_get_range(packetStore->outstandingPackets, packetStateList, seqNum + (SEQNO_SPACE / 2), SEQNO_SPACE - 1); BPTree_get_range(packetStore->outstandingPackets, packetStateList, seqNum + (SEQNO_SPACE / 2), SEQNO_SPACE - 1);
} }
while (List_count(packetStateList) > 0) { while (List_count(packetStateList) > 0) {
PrrtPacket *packet = List_shift(packetStateList); PrrtPacket *packet = List_shift(packetStateList);
lostBytes += packet->payloadLength; lostBytes += packet->payloadLength;
packetStore->outstandingPackets = BPTree_delete(packetStore->outstandingPackets, packet->sequenceNumber); packetStore->outstandingPackets = BPTree_delete(packetStore->outstandingPackets, packet->sequenceNumber);
PrrtPacket_destroy(packet); PrrtPacket_destroy(packet);
}
PrrtPacket_destroy(outstanding_packet);
List_destroy(packetStateList);
} }
List_destroy(packetStateList);
return lostBytes; return lostBytes;
} }
......
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