X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/ffb12fba43635d1d31d7dd073cd4d1ea7d8f4ebd..85edf7ed5948e0efe59301680f79ea0bac4367e8:/dnsasync.pas?ds=sidebyside

diff --git a/dnsasync.pas b/dnsasync.pas
index 68b5c1f..5e72cc0 100644
--- a/dnsasync.pas
+++ b/dnsasync.pas
@@ -7,9 +7,13 @@
 //not seem to have any form of retry code.
 
 unit dnsasync;
-
+{$ifdef fpc}
+  {$mode delphi}
+{$endif}
 interface
 
+{$include lcoreconfig.inc}
+
 uses
   {$ifdef winasyncdns}
     dnswin,
@@ -17,8 +21,6 @@ uses
   lsocket,lcore,
   classes,binipstuff,dnscore,btime,lcorernd;
 
-{$include lcoreconfig.inc}
-
 const
   numsock=1{$ifdef ipv6}+1{$endif};
 
@@ -147,7 +149,7 @@ begin
   if states[socketno].resultaction <> action_done then begin
     //we ignore packets that come after we are done
     if dnsserverids[socketno] >= 0 then begin
-      reportlag(dnsserverids[socketno],trunc((unixtimefloat-startts)*1000000));
+      reportlag(dnsserverids[socketno],trunc((wintimefloat-startts)*1000000));
       dnsserverids[socketno] := -1;
     end;
   {  writeln('received reply');}
@@ -170,7 +172,7 @@ begin
   result := false;
   if len = 0 then exit; {no packet}
   if sockets[socketno].state <> wsconnected then begin
-    startts := unixtimefloat;
+    startts := wintimefloat;
     if port = '' then port := '53';
     sockets[socketno].Proto := 'udp';
     sockets[socketno].ondataavailable := receivehandler;
@@ -265,7 +267,7 @@ begin
 
   if overrideaf = useaf_default then begin
     {$ifdef ipv6}
-      {$ifdef mswindows}if not (usewindns and (addr = '')) then{$endif}
+      {$ifdef winasyncdns}if not (usewindns and (addr = '') and (overridednsserver = '')) then{$endif}
       initpreferredmode;
     {$endif}
     requestaf := useaf;
@@ -274,7 +276,7 @@ begin
   end;
 
   {$ifdef winasyncdns}
-    if usewindns and (addr = '') then begin
+    if usewindns and (addr = '') and (overridednsserver = '') then begin
       dwas := tdnswinasync.create;
       dwas.onrequestdone := winrequestdone;