X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/31d4361fb52761b6486f55af10268a51ee536a6f..eaa75975b23ce60360526c08628f2b0651c95167:/dnssync.pas diff --git a/dnssync.pas b/dnssync.pas index c603b92..1a506d5 100644 --- a/dnssync.pas +++ b/dnssync.pas @@ -109,7 +109,7 @@ end; function sendquery(socknum:integer;const packet:tdnspacket;len:integer):boolean; var - addr : ansistring; + ip : tbinip; port : ansistring; inaddr : TInetSockAddrV; begin @@ -117,14 +117,14 @@ begin result := false; if len = 0 then exit; {no packet} - if overridednsserver <> '' then addr := overridednsserver else addr := getcurrentsystemnameserver(id); + ip := getcurrentsystemnameserverbin(id); {$ifdef ipv6}{$ifdef win32} if toaddr[socknum].family = AF_INET6 then if (useaf = 0) then useaf := useaf_preferv6; {$endif}{$endif} port := toport; - toaddr[socknum] := ipstrtobinf(addr); + toaddr[socknum] := ip; makeinaddrv(toaddr[socknum],port,inaddr); sendto(fd[socknum],packet,len,0,inaddr,inaddrsize(inaddr)); @@ -137,16 +137,14 @@ var inAddrtemp : TInetSockAddrV; a:integer; biniptemp:tbinip; - addr:ansistring; + begin //init both sockets smultaneously, always, so they get succesive fd's if fd[0] > 0 then exit; - if overridednsserver <> '' then addr := overridednsserver else addr := getcurrentsystemnameserver(id); + biniptemp := getcurrentsystemnameserverbin(id); //must get the DNS server here so we know to init v4 or v6 - ipstrtobin(addr,biniptemp); - if biniptemp.family = AF_INET6 then biniptemp := ipstrtobinf('::') else biniptemp := ipstrtobinf('0.0.0.0'); @@ -255,7 +253,7 @@ begin fillchar(state[socknum].recvpacket,sizeof(state[socknum].recvpacket),0); msectotimeval(lag,(currenttime-sendquerytime[socknum]) and tsmask); - if overridednsserver = '' then reportlag(id,(lag.tv_sec*1000000)+lag.tv_usec); + reportlag(id,(lag.tv_sec*1000000)+lag.tv_usec); SrcLen := SizeOf(Src); state[socknum].recvpacketlen := recvfrom(fd[socknum],state[socknum].recvpacket, SizeOf(state[socknum].recvpacket),0,Srcx,SrcLen); @@ -278,7 +276,7 @@ begin currenttime := getts; - if overridednsserver = '' then reportlag(id,-1); + reportlag(id,-1); if (currenttime >= endtime) and ((not wrapmode) or (currenttime < starttime)) then begin exit; end else begin