From 2b97b48369f3c9f26b269b2258faeef67f1381fb Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 29 Mar 2008 18:11:36 +1200 Subject: [PATCH] Replace a goto with do-while --- src/dns_internal.cc | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/dns_internal.cc b/src/dns_internal.cc index 771f1e5619..f3c7f91975 100644 --- a/src/dns_internal.cc +++ b/src/dns_internal.cc @@ -768,29 +768,26 @@ idnsSendQuery(idns_query * q) assert(q->lru.prev == NULL); -try_again: - ns = q->nsends % nns; + do { + ns = q->nsends % nns; - if (q->need_vc) { - idnsSendQueryVC(q, ns); - x = 0; - } else - x = comm_udp_sendto(DnsSocket, - &nameservers[ns].S, - sizeof(nameservers[ns].S), - q->buf, - q->sz); + if (q->need_vc) { + idnsSendQueryVC(q, ns); + x = 0; + } else { + x = comm_udp_sendto(DnsSocket, nameservers[ns].S, sizeof(nameservers[ns].S), q->buf, q->sz); + } - q->nsends++; + q->nsends++; - q->sent_t = current_time; + q->sent_t = current_time; - if (x < 0) { - debugs(50, 1, "idnsSendQuery: FD " << DnsSocket << ": sendto: " << xstrerror()); + if (x < 0) + debugs(50, 1, "idnsSendQuery: FD " << DnsSocket << ": sendto: " << xstrerror()); - if (q->nsends % nns != 0) - goto try_again; - } else { + } while( x<0 && q->nsends % nns != 0); + + if(x >= 0) { fd_bytes(DnsSocket, x, FD_WRITE); commSetSelect(DnsSocket, COMM_SELECT_READ, idnsRead, NULL, 0); } -- 2.47.2