Commit 41c39def authored by Heiko Liermann's avatar Heiko Liermann
Browse files

- bugfix

parent bbfa5aee
......@@ -23,7 +23,7 @@ void *handle_connection(void *arg) {
int main (int argc, char **argv) {
int server_fd;
int thread_fd;
int* thread_fd;
pthread_t client_thread;
struct sockaddr_in server_addr;
......@@ -42,9 +42,15 @@ int main (int argc, char **argv) {
while(1) {
// Speicher allozieren für client_fd
thread_fd = accept_wrapper(server_fd, NULL, NULL);
thread_fd = malloc(sizeof(int));
pthread_create(&client_thread, NULL, &handle_connection, (void *) &thread_fd);
if(thread_fd == NULL) {
continue;
}
*thread_fd = accept_wrapper(server_fd, NULL, NULL);
pthread_create(&client_thread, NULL, &handle_connection, (void *) thread_fd);
pthread_detach(client_thread);
}
......
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