cleanup should be done now

This commit is contained in:
overflowerror 2021-05-13 14:07:04 +02:00
parent d12a968cc2
commit 7490e0a739

View file

@ -690,6 +690,8 @@ void startRequestHandler(struct connection* connection) {
pthread_t dataThreadId;
void dataHandler(int signo) {
pthread_t self = pthread_self();
debug("networking: data handler got called.");
for(link_t* link = linked_first(&connectionList); link != NULL; link = linked_next(link)) {
@ -704,6 +706,15 @@ void dataHandler(int signo) {
connection->inUse++;
pthread_mutex_unlock(&(connection->lock));
// if the connection is persistent there could be still
// unjoined threads -> join them
if (connection->threads.response != PTHREAD_NULL) {
stopThread(self, &(connection->threads.response), false);
}
if (connection->threads.encoder != PTHREAD_NULL) {
stopThread(self, &(connection->threads.encoder), false);
}
int tmp;
char c;
char buffer[BUFFER_LENGTH];