lcore.org gitweb
/
lcore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed incorrect executable status from files
[lcore.git]
/
dnssync.pas
diff --git
a/dnssync.pas
b/dnssync.pas
index 79ace01ca056e4d63312b7a2e807a307f539fb33..7dedcca6ebf47874b0c90b90014ae6fb7c5f1ece 100644
(file)
--- a/
dnssync.pas
+++ b/
dnssync.pas
@@
-13,7
+13,7
@@
interface
uses
\r
dnscore,
\r
binipstuff,
\r
uses
\r
dnscore,
\r
binipstuff,
\r
- {$ifdef
win32
}
\r
+ {$ifdef
mswindows
}
\r
winsock,
\r
windows,
\r
{$else}
\r
winsock,
\r
windows,
\r
{$else}
\r
@@
-60,12
+60,12
@@
const
\r
implementation
\r
\r
\r
implementation
\r
\r
-{$ifdef
win32
}
\r
+{$ifdef
mswindows
}
\r
uses dnswin;
\r
{$endif}
\r
\r
\r
uses dnswin;
\r
{$endif}
\r
\r
\r
-{$ifndef
win32
}
\r
+{$ifndef
mswindows
}
\r
{$define syncdnscore}
\r
{$endif}
\r
\r
{$define syncdnscore}
\r
{$endif}
\r
\r
@@
-76,7
+76,7
@@
type tdnsstatearr=array[0..numsock-1] of tdnsstate;
{$ifdef syncdnscore}
\r
\r
\r
{$ifdef syncdnscore}
\r
\r
\r
-{$ifdef
win32
}
\r
+{$ifdef
mswindows
}
\r
const
\r
winsocket = 'wsock32.dll';
\r
function sendto(s: TSocket; const Buf; len, flags: Integer; var addrto: TinetSockAddrV; tolen: Integer): Integer; stdcall; external winsocket name 'sendto';
\r
const
\r
winsocket = 'wsock32.dll';
\r
function sendto(s: TSocket; const Buf; len, flags: Integer; var addrto: TinetSockAddrV; tolen: Integer): Integer; stdcall; external winsocket name 'sendto';
\r
@@
-87,7
+87,7
@@
type tdnsstatearr=array[0..numsock-1] of tdnsstate;
\r
\r
function getts:integer;
\r
\r
\r
function getts:integer;
\r
-{$ifdef
win32
}
\r
+{$ifdef
mswindows
}
\r
begin
\r
result := GetTickCount and tsmask;
\r
{$else}
\r
begin
\r
result := GetTickCount and tsmask;
\r
{$else}
\r
@@
-117,7
+117,7
@@
var
a,b:integer;
\r
\r
Src : TInetSockAddrV;
\r
a,b:integer;
\r
\r
Src : TInetSockAddrV;
\r
- Srcx : {$ifdef
win32
}sockaddr_in{$else}TInetSockAddrV{$endif} absolute Src;
\r
+ Srcx : {$ifdef
mswindows
}sockaddr_in{$else}TInetSockAddrV{$endif} absolute Src;
\r
SrcLen : Integer;
\r
fromip:tbinip;
\r
fromport:ansistring;
\r
SrcLen : Integer;
\r
fromip:tbinip;
\r
fromport:ansistring;
\r
@@
-132,7
+132,7
@@
procedure setupsocket;
var
\r
inAddrtemp : TInetSockAddrV;
\r
biniptemp:tbinip;
\r
var
\r
inAddrtemp : TInetSockAddrV;
\r
biniptemp:tbinip;
\r
- a,retrycount:integer;
\r
+ a,retrycount
,porttemp
:integer;
\r
bindresult:boolean;
\r
begin
\r
biniptemp := getcurrentsystemnameserverbin(id);
\r
bindresult:boolean;
\r
begin
\r
biniptemp := getcurrentsystemnameserverbin(id);
\r
@@
-144,15
+144,21
@@
begin
for a := 0 to numsockused-1 do begin
\r
retrycount := 5;
\r
repeat
\r
for a := 0 to numsockused-1 do begin
\r
retrycount := 5;
\r
repeat
\r
- makeinaddrv(biniptemp,inttostr( 1024 + randominteger(65536 - 1024) ),inaddrtemp);
\r
+ if (retrycount <= 1) then begin
\r
+ porttemp := 0; //for the last attempt let the OS decide
\r
+ end else begin
\r
+ porttemp := 1024 + randominteger(65536 - 1024);
\r
+ end;
\r
+
\r
+ makeinaddrv(biniptemp,inttostr( porttemp ),inaddrtemp);
\r
\r
fd[a] := Socket(biniptemp.family,SOCK_DGRAM,0);
\r
\r
fd[a] := Socket(biniptemp.family,SOCK_DGRAM,0);
\r
- bindresult := {$ifdef
win32
}Not{$endif} Bind(fd[a],inAddrtemp,inaddrsize(inaddrtemp));
\r
+ bindresult := {$ifdef
mswindows
}Not{$endif} Bind(fd[a],inAddrtemp,inaddrsize(inaddrtemp));
\r
dec(retrycount);
\r
until (retrycount <= 0) or (bindresult);
\r
\r
If (not bindresult) Then begin
\r
dec(retrycount);
\r
until (retrycount <= 0) or (bindresult);
\r
\r
If (not bindresult) Then begin
\r
- {$ifdef
win32
}
\r
+ {$ifdef
mswindows
}
\r
raise Exception.create('unable to bind '+inttostr(WSAGetLastError));
\r
{$else}
\r
raise Exception.create('unable to bind '+inttostr(socketError));
\r
raise Exception.create('unable to bind '+inttostr(WSAGetLastError));
\r
{$else}
\r
raise Exception.create('unable to bind '+inttostr(socketError));
\r
@@
-180,7
+186,7
@@
begin
\r
ip := getcurrentsystemnameserverbin(id);
\r
\r
\r
ip := getcurrentsystemnameserverbin(id);
\r
\r
- {$ifdef ipv6}{$ifdef
win32
}
\r
+ {$ifdef ipv6}{$ifdef
mswindows
}
\r
if toaddr[socknum].family = AF_INET6 then if (useaf = 0) then useaf := useaf_preferv6;
\r
{$endif}{$endif}
\r
\r
if toaddr[socknum].family = AF_INET6 then if (useaf = 0) then useaf := useaf_preferv6;
\r
{$endif}{$endif}
\r
\r
@@
-321,7
+327,7
@@
begin
exit; //it was an IP address, no need for dns
\r
end;
\r
\r
exit; //it was an IP address, no need for dns
\r
end;
\r
\r
- {$ifdef
win32
}
\r
+ {$ifdef
mswindows
}
\r
if usewindns then begin
\r
if (useaf = useaf_v4) then a := af_inet else if (useaf = useaf_v6) then a := af_inet6 else a := 0;
\r
result := winforwardlookuplist(name,a,dummy);
\r
if usewindns then begin
\r
if (useaf = useaf_v4) then a := af_inet else if (useaf = useaf_v6) then a := af_inet6 else a := 0;
\r
result := winforwardlookuplist(name,a,dummy);
\r
@@
-392,7
+398,7
@@
var
numsockused:integer;
\r
state:tdnsstatearr;
\r
begin
\r
numsockused:integer;
\r
state:tdnsstatearr;
\r
begin
\r
- {$ifdef
win32
}
\r
+ {$ifdef
mswindows
}
\r
if usewindns then begin
\r
result := winreverselookup(ip,dummy);
\r
exit;
\r
if usewindns then begin
\r
result := winreverselookup(ip,dummy);
\r
exit;
\r
@@
-406,7
+412,7
@@
begin
{$endif}
\r
end;
\r
\r
{$endif}
\r
end;
\r
\r
-{$ifdef
win32
}
\r
+{$ifdef
mswindows
}
\r
var
\r
wsadata : twsadata;
\r
\r
var
\r
wsadata : twsadata;
\r
\r