Commit ba191ccb authored by Andreas Schmidt's avatar Andreas Schmidt
Browse files

Fixed receiver termination again.

parent 8160f1d1
......@@ -16,6 +16,7 @@
#include "block.h"
int PrrtSocket_create(PrrtSocket *sock_ptr, const uint16_t port, const uint8_t is_sender) {
sock_ptr->sequenceNumberSource = 1;
sock_ptr->sequenceNumberRedundancy = 1;
......@@ -155,6 +156,7 @@ int PrrtSocket_interrupt(PrrtSocket *sock_ptr) {
pthread_cond_signal(&sock_ptr->inQueueFilledCv);
pthread_mutex_unlock(&sock_ptr->inQueueFilledMutex);
pthread_cancel(sock_ptr->receiveDataThread);
pthread_join(sock_ptr->receiveDataThread, res);
sock_ptr->receiveDataThread = 0;
......@@ -166,9 +168,11 @@ int PrrtSocket_interrupt(PrrtSocket *sock_ptr) {
sock_ptr->receiveFeedbackThread = 0;
}
debug("Interrupted all threads.");
}
int PrrtSocket_close(PrrtSocket *sock_ptr) {
debug("Closing socket.");
pthread_mutex_lock(&sock_ptr->closingMutex);
if (!sock_ptr->closing) {
pthread_mutex_unlock(&sock_ptr->closingMutex);
......@@ -234,6 +238,7 @@ int PrrtSocket_close(PrrtSocket *sock_ptr) {
close(sock_ptr->dataSocketFd);
close(sock_ptr->feedbackSocketFd);
debug("Socket closed.");
return 0;
}
......
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