]> git.ipfire.org Git - thirdparty/ldns.git/commitdiff
ldns_axfr_abort function from Roland van Rijswijk
authorWillem Toorop <willem@NLnetLabs.nl>
Wed, 13 Feb 2013 13:55:14 +0000 (13:55 +0000)
committerWillem Toorop <willem@NLnetLabs.nl>
Wed, 13 Feb 2013 13:55:14 +0000 (13:55 +0000)
resolver.c

index 2cee9fff194a1320c3ea616fe0fe51e1f18575ef..dc1f77cbb1306adabc5b40672674ff8fc5d2ee3c 100644 (file)
@@ -1329,6 +1329,26 @@ ldns_axfr_next(ldns_resolver *resolver)
 
 }
 
+/* RoRi: this function is needed to abort a transfer that is in progress;
+ *       without it an aborted transfer will lead to the AXFR code in the
+ *       library staying in an indetermined state because the socket for the
+ *       AXFR is never closed
+ */
+void
+ldns_axfr_abort(ldns_resolver *resolver)
+{
+       /* Only abort if an actual AXFR is in progress */
+       if (resolver->_socket != 0)
+       {
+#ifndef USE_WINSOCK
+               close(resolver->_socket);
+#else
+               closesocket(resolver->_socket);
+#endif
+               resolver->_socket = 0;
+       }
+}
+
 bool
 ldns_axfr_complete(const ldns_resolver *res)
 {