lcore.org gitweb
/
lcore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix dnscore based resolving failure on windows
[lcore.git]
/
dnssync.pas
diff --git
a/dnssync.pas
b/dnssync.pas
index 7d6631c97b73011641e8bd0b778855e408d5c72c..1a506d5a93a92676ae1e39695f53554613f2c89b 100644
(file)
--- a/
dnssync.pas
+++ b/
dnssync.pas
@@
-75,14
+75,14
@@
implementation
\r
{$i unixstuff.inc}
\r
\r
\r
{$i unixstuff.inc}
\r
\r
+
\r
+{$ifdef syncdnscore}
\r
var
\r
numsockused:integer;
\r
fd:array[0..numsock-1] of integer;
\r
state:array[0..numsock-1] of tdnsstate;
\r
toaddr:array[0..numsock-1] of tbinip;
\r
\r
var
\r
numsockused:integer;
\r
fd:array[0..numsock-1] of integer;
\r
state:array[0..numsock-1] of tdnsstate;
\r
toaddr:array[0..numsock-1] of tbinip;
\r
\r
-{$ifdef syncdnscore}
\r
-
\r
{$ifdef win32}
\r
const
\r
winsocket = 'wsock32.dll';
\r
{$ifdef win32}
\r
const
\r
winsocket = 'wsock32.dll';
\r
@@
-109,8
+109,7
@@
end;
\r
function sendquery(socknum:integer;const packet:tdnspacket;len:integer):boolean;
\r
var
\r
\r
function sendquery(socknum:integer;const packet:tdnspacket;len:integer):boolean;
\r
var
\r
- a:integer;
\r
- addr : ansistring;
\r
+ ip : tbinip;
\r
port : ansistring;
\r
inaddr : TInetSockAddrV;
\r
begin
\r
port : ansistring;
\r
inaddr : TInetSockAddrV;
\r
begin
\r
@@
-118,14
+117,14
@@
begin
result := false;
\r
if len = 0 then exit; {no packet}
\r
\r
result := false;
\r
if len = 0 then exit; {no packet}
\r
\r
- i
f overridednsserver <> '' then addr := overridednsserver else addr := getcurrentsystemnameserver
(id);
\r
+ i
p := getcurrentsystemnameserverbin
(id);
\r
\r
{$ifdef ipv6}{$ifdef win32}
\r
if toaddr[socknum].family = AF_INET6 then if (useaf = 0) then useaf := useaf_preferv6;
\r
{$endif}{$endif}
\r
\r
port := toport;
\r
\r
{$ifdef ipv6}{$ifdef win32}
\r
if toaddr[socknum].family = AF_INET6 then if (useaf = 0) then useaf := useaf_preferv6;
\r
{$endif}{$endif}
\r
\r
port := toport;
\r
- toaddr[socknum] := ip
strtobinf(addr)
;
\r
+ toaddr[socknum] := ip;
\r
makeinaddrv(toaddr[socknum],port,inaddr);
\r
\r
sendto(fd[socknum],packet,len,0,inaddr,inaddrsize(inaddr));
\r
makeinaddrv(toaddr[socknum],port,inaddr);
\r
\r
sendto(fd[socknum],packet,len,0,inaddr,inaddrsize(inaddr));
\r
@@
-138,16
+137,14
@@
var
inAddrtemp : TInetSockAddrV;
\r
a:integer;
\r
biniptemp:tbinip;
\r
inAddrtemp : TInetSockAddrV;
\r
a:integer;
\r
biniptemp:tbinip;
\r
- addr:ansistring;
\r
+
\r
begin
\r
//init both sockets smultaneously, always, so they get succesive fd's
\r
if fd[0] > 0 then exit;
\r
\r
begin
\r
//init both sockets smultaneously, always, so they get succesive fd's
\r
if fd[0] > 0 then exit;
\r
\r
-
if overridednsserver <> '' then addr := overridednsserver else addr := getcurrentsystemnameserver
(id);
\r
+
biniptemp := getcurrentsystemnameserverbin
(id);
\r
//must get the DNS server here so we know to init v4 or v6
\r
\r
//must get the DNS server here so we know to init v4 or v6
\r
\r
- ipstrtobin(addr,biniptemp);
\r
-
\r
if biniptemp.family = AF_INET6 then biniptemp := ipstrtobinf('::') else biniptemp := ipstrtobinf('0.0.0.0');
\r
\r
\r
if biniptemp.family = AF_INET6 then biniptemp := ipstrtobinf('::') else biniptemp := ipstrtobinf('0.0.0.0');
\r
\r
\r
@@
-177,7
+174,6
@@
var
currenttime : integer;
\r
\r
lag : ttimeval;
\r
currenttime : integer;
\r
\r
lag : ttimeval;
\r
- currenttimeout : ttimeval;
\r
selecttimeout : ttimeval;
\r
socknum:integer;
\r
needprocessing:array[0..numsock-1] of boolean;
\r
selecttimeout : ttimeval;
\r
socknum:integer;
\r
needprocessing:array[0..numsock-1] of boolean;
\r
@@
-257,7
+253,7
@@
begin
fillchar(state[socknum].recvpacket,sizeof(state[socknum].recvpacket),0);
\r
msectotimeval(lag,(currenttime-sendquerytime[socknum]) and tsmask);
\r
\r
fillchar(state[socknum].recvpacket,sizeof(state[socknum].recvpacket),0);
\r
msectotimeval(lag,(currenttime-sendquerytime[socknum]) and tsmask);
\r
\r
-
if overridednsserver = '' then
reportlag(id,(lag.tv_sec*1000000)+lag.tv_usec);
\r
+ reportlag(id,(lag.tv_sec*1000000)+lag.tv_usec);
\r
\r
SrcLen := SizeOf(Src);
\r
state[socknum].recvpacketlen := recvfrom(fd[socknum],state[socknum].recvpacket, SizeOf(state[socknum].recvpacket),0,Srcx,SrcLen);
\r
\r
SrcLen := SizeOf(Src);
\r
state[socknum].recvpacketlen := recvfrom(fd[socknum],state[socknum].recvpacket, SizeOf(state[socknum].recvpacket),0,Srcx,SrcLen);
\r
@@
-280,7
+276,7
@@
begin
\r
currenttime := getts;
\r
\r
\r
currenttime := getts;
\r
\r
-
if overridednsserver = '' then
reportlag(id,-1);
\r
+ reportlag(id,-1);
\r
if (currenttime >= endtime) and ((not wrapmode) or (currenttime < starttime)) then begin
\r
exit;
\r
end else begin
\r
if (currenttime >= endtime) and ((not wrapmode) or (currenttime < starttime)) then begin
\r
exit;
\r
end else begin
\r
@@
-299,7
+295,7
@@
end;
function forwardlookuplist(name:ansistring;timeout:integer):tbiniplist;
\r
var
\r
dummy : integer;
\r
function forwardlookuplist(name:ansistring;timeout:integer):tbiniplist;
\r
var
\r
dummy : integer;
\r
- a
,b
:integer;
\r
+ a:integer;
\r
biniptemp:tbinip;
\r
l:tbiniplist;
\r
begin
\r
biniptemp:tbinip;
\r
l:tbiniplist;
\r
begin
\r