Commit 40464d0a authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Coding parameters are now part of one socket object.

parent bddc0f73
Pipeline #819 passed with stages
in 57 seconds
......@@ -53,14 +53,12 @@ void *send_data_loop(void *ptr)
{
PrrtSocket *sock_ptr = ptr;
PrrtBlock *block = NULL;
PrrtCodingParams *cpar = PrrtCodingParams_create();
while(1) {
check(pthread_mutex_lock(&sock_ptr->outQueueFilledMutex) == 0, "Lock failed.");
while(List_count(sock_ptr->outQueue) == 0) {
check(pthread_mutex_lock(&sock_ptr->closingMutex) == 0, "Lock failed.");
if(sock_ptr->closing) {
PrrtCodingParams_destroy(cpar);
if(block != NULL) {
PrrtBlock_destroy(block);
}
......@@ -74,7 +72,7 @@ void *send_data_loop(void *ptr)
}
if(block == NULL) {
block = PrrtBlock_create(cpar, sock_ptr->sequenceNumberSource);
block = PrrtBlock_create(sock_ptr->codingParams, sock_ptr->sequenceNumberSource);
}
PrrtPacket *packet = List_shift(sock_ptr->outQueue);
......
......@@ -28,6 +28,8 @@ PrrtSocket *PrrtSocket_create(const bool is_sender)
sock_ptr->clock = PrrtClock_create();
sock_ptr->codingParams = PrrtCodingParams_create();
sock_ptr->isBound = false;
sock_ptr->sequenceNumberSource = 1;
......@@ -273,6 +275,9 @@ int PrrtSocket_close(PrrtSocket *sock_ptr) {
check(PrrtApplicationConstraints_destroy(sock_ptr->applicationConstraints), "Could not destroy application constraints.")
}
if(sock_ptr->codingParams != NULL)
check(PrrtCodingParams_destroy(sock_ptr->codingParams), "Destroy coding params failed.")
if(sock_ptr->clock != NULL) {
check(PrrtClock_destroy(sock_ptr->clock), "Destroy clock failed");
}
......
......@@ -42,6 +42,8 @@ typedef struct prrtSocket {
PrrtForwardPacketTable* forwardPacketTable;
PrrtCodingParams* codingParams;
List* receivers;
pthread_mutex_t closingMutex;
......
Supports Markdown
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