]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
misc nitpicks
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 14 Sep 2018 08:21:43 +0000 (10:21 +0200)
committerGrigorii Demidov <grigorii.demidov@nic.cz>
Fri, 14 Sep 2018 12:40:38 +0000 (14:40 +0200)
- \param family, esp. don't rely on AF_UNSPEC being zero
- kres_gnutls_vec_push(): don't uv_write() if ENOMEM
- tls_client_params_clear(): remove unused function

daemon/io.c
daemon/io.h
daemon/tls.c
daemon/tls.h

index c82462f7f74afe3a45cf14bd527460c6baf8b779..e5b8a139a81566b464ee9863d9fa503109e92e44 100644 (file)
@@ -271,7 +271,7 @@ static void _tcp_accept(uv_stream_t *master, int status, bool tls)
                return;
        }
        memset(client, 0, sizeof(*client));
-       int res = io_create(master->loop, (uv_handle_t *)client, SOCK_STREAM, 0);
+       int res = io_create(master->loop, (uv_handle_t *)client, SOCK_STREAM, AF_UNSPEC);
        if (res) {
                if (res == UV_EMFILE) {
                        worker->too_many_open = true;
index 51976b07e3283ec72dbccfb3931a31c699f44673..428cc62a392bb3c7d866bcf6f86a7141e615d77d 100644 (file)
@@ -59,7 +59,9 @@ int tcp_bind_tls(uv_tcp_t *handle, struct sockaddr *addr);
 int tcp_bindfd(uv_tcp_t *handle, int fd);
 int tcp_bindfd_tls(uv_tcp_t *handle, int fd);
 
-/** Initialize the handle, incl. ->data = struct session * instance. type = SOCK_* */
+/** Initialize the handle, incl. ->data = struct session * instance.
+ * \param type = SOCK_*
+ * \param family = AF_* */
 int io_create(uv_loop_t *loop, uv_handle_t *handle, int type, unsigned family);
 void io_deinit(uv_handle_t *handle);
 void io_free(uv_handle_t *handle);
index 0b31dca250b58c2b4c459bd0d9bf7463a5831622..0fdc6f9e164ce08c11bc3a4cb9902121b4ec91a2 100644 (file)
@@ -203,7 +203,7 @@ static ssize_t kres_gnutls_vec_push(gnutls_transport_ptr_t h, const giovec_t * i
                } else {
                        free(buf);
                        errno = ENOMEM;
-                       ret = -1;
+                       return -1;
                }
 
                /* Perform an asynchronous write with a callback */
@@ -781,29 +781,6 @@ static int client_paramlist_entry_clear(const char *k, void *v, void *baton)
        return client_paramlist_entry_free(entry);
 }
 
-int tls_client_params_clear(map_t *tls_client_paramlist, const char *addr, uint16_t port)
-{
-       if (!tls_client_paramlist || !addr) {
-               return kr_error(EINVAL);
-       }
-
-       /* Parameters are OK */
-
-       char key[INET6_ADDRSTRLEN + 6];
-       size_t keylen = sizeof(key);
-       if (kr_straddr_join(addr, port, key, &keylen) != kr_ok()) {
-               return kr_error(EINVAL);
-       }
-
-       struct tls_client_paramlist_entry *entry = map_get(tls_client_paramlist, key);
-       if (entry != NULL) {
-               client_paramlist_entry_unref(entry);
-               map_del(tls_client_paramlist, key);
-       }
-
-       return kr_ok();
-}
-
 int tls_client_params_set(map_t *tls_client_paramlist,
                          const char *addr, uint16_t port,
                          const char *param, tls_client_param_t param_type)
index ce13d20bb21799b52db0dfb4b66d5a896bcfbe4d..d208f4cb80e0acc7a1c48e3082e46d4ef53dccbd 100644 (file)
@@ -167,9 +167,6 @@ int tls_set_hs_state(struct tls_common_ctx *ctx, tls_hs_state_t state);
 struct tls_client_paramlist_entry *tls_client_try_upgrade(map_t *tls_client_paramlist,
                          const struct sockaddr *addr);
 
-/*! Clear (remove) TLS parameters for given address. */
-int tls_client_params_clear(map_t *tls_client_paramlist, const char *addr, uint16_t port);
-
 /*! Set TLS authentication parameters for given address.
  * Note: hostnames must be imported before ca files,
  *       otherwise ca files will not be imported at all.