X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/eaa75975b23ce60360526c08628f2b0651c95167..19e44013088ff80c11e1d7c045331b96f4dc41f0:/dnsasync.pas

diff --git a/dnsasync.pas b/dnsasync.pas
index b6e8941..68b5c1f 100644
--- a/dnsasync.pas
+++ b/dnsasync.pas
@@ -11,7 +11,7 @@ unit dnsasync;
 interface
 
 uses
-  {$ifdef win32}
+  {$ifdef winasyncdns}
     dnswin,
   {$endif}
   lsocket,lcore,
@@ -39,7 +39,7 @@ type
 
     dnsserverids : array[0..numsock-1] of integer;
     startts:double;
-    {$ifdef win32}
+    {$ifdef winasyncdns}
       dwas : tdnswinasync;
     {$endif}
 
@@ -49,7 +49,7 @@ type
     procedure asyncprocess(socketno:integer);
     procedure receivehandler(sender:tobject;error:word);
     function sendquery(socketno:integer;const packet:tdnspacket;len:integer):boolean;
-    {$ifdef win32}
+    {$ifdef winasyncdns}
       procedure winrequestdone(sender:tobject;error:word);
     {$endif}
 
@@ -57,7 +57,7 @@ type
     onrequestdone:tsocketevent;
 
     //addr and port allow the application to specify a dns server specifically
-    //for this dnsasync object. This is not a reccomended mode of operation
+    //for this dnsasync object. This is not a recommended mode of operation
     //because it limits the app to one dns server but is kept for compatibility
     //and special uses.
     addr,port:ansistring;
@@ -69,7 +69,7 @@ type
     procedure dnsresultbin(var binip:tbinip); //get result of dnslookup as a tbinip
     property dnsresultlist : tbiniplist read fresultlist;
     procedure forwardlookup(const name:ansistring); //start forward lookup,
-                                                //preffering ipv4
+                                                //preferring ipv4
     procedure reverselookup(const binip:tbinip); //start reverse lookup
     procedure customlookup(const name:ansistring;querytype:integer); //start custom type lookup
 
@@ -109,6 +109,14 @@ begin
       setstate_request_init('',states[socketno]);
     end;
   end;
+
+  {$ifdef winasyncdns}
+  if assigned(dwas) then begin
+    dwas.release;
+    dwas := nil;
+  end;
+  {$endif}
+
   inherited destroy;
 end;
 
@@ -191,7 +199,7 @@ begin
   end;
   destinations[socketno] := destination;
 
-  {$ifdef ipv6}{$ifdef win32}
+  {$ifdef ipv6}{$ifdef mswindows}
   if destinations[socketno].family = AF_INET6 then if (requestaf = useaf_default) then requestaf := useaf_preferv6;
   {$endif}{$endif}
 
@@ -257,7 +265,7 @@ begin
 
   if overrideaf = useaf_default then begin
     {$ifdef ipv6}
-      {$ifdef win32}if not (usewindns and (addr = '')) then{$endif}
+      {$ifdef mswindows}if not (usewindns and (addr = '')) then{$endif}
       initpreferredmode;
     {$endif}
     requestaf := useaf;
@@ -265,7 +273,7 @@ begin
     requestaf := overrideaf;
   end;
 
-  {$ifdef win32}
+  {$ifdef winasyncdns}
     if usewindns and (addr = '') then begin
       dwas := tdnswinasync.create;
       dwas.onrequestdone := winrequestdone;
@@ -297,7 +305,7 @@ end;
 
 procedure tdnsasync.reverselookup;
 begin
-  {$ifdef win32}
+  {$ifdef winasyncdns}
     if usewindns and (addr = '') then begin
       dwas := tdnswinasync.create;
       dwas.onrequestdone := winrequestdone;
@@ -334,7 +342,7 @@ procedure tdnsasync.cancel;
 var
   socketno : integer;
 begin
-  {$ifdef win32}
+  {$ifdef winasyncdns}
     if assigned(dwas) then begin
       dwas.release;
       dwas := nil;
@@ -357,7 +365,7 @@ begin
   onrequestdone(self,0);
 end;
 
-{$ifdef win32}
+{$ifdef winasyncdns}
   procedure tdnsasync.winrequestdone(sender:tobject;error:word);
  
   begin