CLEANUP: dns: Remove useless test on ns->dgram in dns_connect_nameserver()

When dns_connect_nameserver() is called, the nameserver has always a dgram
field properly defined. The caller, dns_send_nameserver(), already performed
the appropriate verification.
This commit is contained in:
Christopher Faulet 2021-03-04 16:58:35 +01:00
parent 1a1b674c2c
commit 1e711beb51

View File

@ -41,11 +41,10 @@ DECLARE_STATIC_POOL(dns_query_pool, "dns_query", sizeof(struct dns_query));
DECLARE_STATIC_POOL(dns_msg_buf, "dns_msg_buf", DNS_TCP_MSG_RING_MAX_SIZE); DECLARE_STATIC_POOL(dns_msg_buf, "dns_msg_buf", DNS_TCP_MSG_RING_MAX_SIZE);
/* Opens an UDP socket on the namesaver's IP/Port, if required. Returns 0 on /* Opens an UDP socket on the namesaver's IP/Port, if required. Returns 0 on
* success, -1 otherwise. * success, -1 otherwise. ns->dgram must be defined.
*/ */
static int dns_connect_nameserver(struct dns_nameserver *ns) static int dns_connect_nameserver(struct dns_nameserver *ns)
{ {
if (ns->dgram) {
struct dgram_conn *dgram = &ns->dgram->conn; struct dgram_conn *dgram = &ns->dgram->conn;
int fd; int fd;
@ -78,9 +77,6 @@ static int dns_connect_nameserver(struct dns_nameserver *ns)
return 0; return 0;
} }
return -1;
}
/* Sends a message to a name server /* Sends a message to a name server
* It returns message length on success * It returns message length on success
* or -1 in error case * or -1 in error case