]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Remove unused ttl, the client is related to the socket file descriptor
authorpcarana <pc.moreno2099@gmail.com>
Fri, 8 Mar 2019 15:28:57 +0000 (09:28 -0600)
committerpcarana <pc.moreno2099@gmail.com>
Fri, 8 Mar 2019 15:28:57 +0000 (09:28 -0600)
src/clients.c
src/clients.h
src/rtr/rtr.c

index bc81eb0f41d586d508a5b5118f94c0559744e889..4495e3edd6ae86d613894a66cdcc5e2c22c1aadb 100644 (file)
@@ -54,8 +54,7 @@ static struct client
 }
 
 static int
-create_client(int fd, struct sockaddr_storage *addr, u_int8_t rtr_version,
-    time_t ttl)
+create_client(int fd, struct sockaddr_storage *addr, u_int8_t rtr_version)
 {
        struct client *client;
 
@@ -75,21 +74,19 @@ create_client(int fd, struct sockaddr_storage *addr, u_int8_t rtr_version,
                client->sin_port = SADDR_IN6(addr)->sin6_port;
        }
        client->rtr_version = rtr_version;
-       client->expiration = time(NULL) + ttl;
 
        return clients_db_add_client(client);
 }
 
 int
-update_client(int fd, struct sockaddr_storage *addr, u_int8_t rtr_version,
-    time_t ttl)
+update_client(int fd, struct sockaddr_storage *addr, u_int8_t rtr_version)
 {
        struct client *client;
        client = get_client(addr, rtr_version);
 
        if (client == NULL)
-               return create_client(fd, addr, rtr_version, ttl);
-       client->expiration = time(NULL) + ttl;
+               return create_client(fd, addr, rtr_version);
+       client->fd = fd;
        return 0;
 }
 
index 2f218b88d1891d50de3d83019a4ee7a95167db6f..6888f32c1f9bf7a94499286b10103a15eb8a9a1a 100644 (file)
@@ -2,7 +2,6 @@
 #define SRC_CLIENTS_H_
 
 #include <arpa/inet.h>
-#include <time.h>
 
 struct client {
        int fd;
@@ -13,12 +12,10 @@ struct client {
        };
        in_port_t sin_port;
        u_int8_t rtr_version;
-       /* TODO forget clients when the expiration time is reached */
-       time_t expiration;
 };
 
 int clients_db_init(void);
-int update_client(int fd, struct sockaddr_storage *, u_int8_t, time_t);
+int update_client(int fd, struct sockaddr_storage *, u_int8_t);
 size_t client_list(struct client **);
 void clients_db_destroy(void);
 
index 9f332a2e6855a19d2e586d24b4c15760932ab009..3b9fac4911abd7d04f3e28ee4a2e670b9e845061 100644 (file)
@@ -125,9 +125,7 @@ client_thread_cb(void *param_void)
                        return NULL;
 
                /* RTR Version ready, now update client */
-               /* TODO Remove this hardcoded ttl */
-               err = update_client(param.client_fd, &param.client_addr, rtr_version,
-                   3600);
+               err = update_client(param.client_fd, &param.client_addr, rtr_version);
                if (err)
                        return NULL;
 
@@ -183,9 +181,6 @@ handle_client_connections(int server_fd)
                arg->client_fd = client_fd;
                arg->client_addr = client_addr;
 
-               /*
-                * FIXME Handle session IDs, serial IDs, protocol version
-                */
                errno = pthread_create(&thread, NULL, client_thread_cb, arg);
                if (errno) {
                        warn("Could not spawn the client's thread");