Fixes and issues for Indy 10.2.0.3 on Debian/Linux (Lazarus 0.9.30, FPC 2.4.2) lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- jl · 2011-07-02 18:28 Hi, I'm starting this thread to report issues and also suggested fixes my team has made for Indy 10.2.0.3 on Debian/Linux (Lazarus 0.9.30, FPC 2.4.2.) while working for my projects - also see http://wiki.lazarus.freepascal.org/Indy_with_Lazarus Please also share if you found anything.  Thanks. 1). Add {$DEFINE IDFREEONFINAL} to IdCompilerDefines.inc. This is required to reduce memory leaks. 2). IdIcmpClient.pas (attached) Add function: Code: [Select]{$IFDEF FPC}   {$IFDEF UNIX}     function DWordInvert(Data: LongWord): LongWord;     begin       Result :=         (Data shr 24) +         (((Data shl 8) shr 24) shl 8) +         (((Data shl 16) shr 24) shl 16) +         (Data shl 24);     end;   {$ENDIF} Created DWORD inverter for use instead of GStack.NetworkToHost on *nix which raises RangeCheckError.  Reason not known.  Might affect other units but we've not tested all. Replace code: Code: [Select]      FReplyStatus.FromIpAddress := MakeDWordIntoIPv4Add ress(GStack.NetworkToHost(Licmp.ip_hdr.ip_src.s_l));       FReplyStatus.ToIpAddress   := MakeDWordIntoIPv4Address(GStack.Ne tworkToHost(Licmp.ip_hdr.ip_dst.s_l)); With: Code: [Select]      {$IFDEF FPC}         {$IFDEF UNIX}           FReplyStatus.FromIpAddress := MakeDWordIntoIPv4Address(DWordInvert(Licmp.ip_hdr.ip_src.s_l));           FReplyStatus.ToIpAddress   := MakeDWordIntoIPv4Address(DWordInvert(Licmp.ip_hdr.ip_dst.s_l));         {$ELSE}           FReplyStatus.FromIpAddress := MakeDWordIntoIPv4Address(GStac k.NetworkToHost(Licmp.ip_hdr.ip_src.s_l));           FReplyStatus.ToIpAddress   := MakeDWordIntoIPv4Address(GStac k.NetworkToHost(Licmp.ip_hdr.ip_dst.s_l));         {$ENDIF}       {$ELSE}         FReplyStatus.FromIpAddress := MakeDWordIntoIPv4Address(GStack. NetworkToHost(Licmp.ip_hdr.ip_src.s_l));         FReplyStatus.ToIpAddress   := MakeDWordIntoIPv4Address(GStack. NetworkToHost(Licmp.ip_hdr.ip_dst.s_l));       {$ENDIF} 3). IdIcmpClient.pas (attached) Commented line 790 to fix range check error when using a 16bit word increment.  Reason not known. Replace code: Code: [Select] Inc(wSeqNo); // SG 25/1/02: Only increase sequence number when finished. With: Code: [Select]// Inc(wSeqNo); // SG 25/1/02: Only increase sequence number when finished. 4). *UNRESOLVED* - NETDB's ResolveName in IdStackUnix.pas failing intermittently - affects all Indy client components that need to resolve DNS. FPC bug report - http://62.166.198.202/view.php?id=19493 ---------------------------------------------------------------------- JD · 2011-07-02 20:33 Would be nice if you inform the Indy team so that they can commit your changes to Indy svn. ---------------------------------------------------------------------- marcov · 2011-07-02 20:54 First, try a recent version. Some of these might already have been fixed. Quote from: touchring on July 02, 2011, 08:28:55 pm 1). Add {$DEFINE IDFREEONFINAL} to IdCompilerDefines.inc. Afaik that define is only used during memory leak checking to reduce output. It surpresses a small amount of allocations that is never deallocated during normal operation. (IIRC these are not dellocated is because it avoids additional exceptions during shutdown if some problem occured during normal operation) Quote2). IdIcmpClient.pas (attached) Add function: Use endian functions from socket or system unit. The code you suggest only works for little endian platforms. (e.g. on PowerPCs it will go wrong, since there network order=host order. Quote 3). IdIcmpClient.pas (attached) Commented line 790 to fix range check error when using a 16bit word increment.  Reason not known. I sincerely doubt the indy units were designed to run with range checking. Moreover, commenting that line disables functionality. A better solution would be something like wsegno:=(wsegno+1) and 65535; That also surpresses the range check, but leaves the code intact. Quote4). *UNRESOLVED* - NETDB's ResolveName in IdStackUnix.pas failing intermittently - affects all Indy client components that need to resolve DNS. FPC bug report - http://62.166.198.202/view.php?id=19493 In 2.4.4 one can resort to cnetdb which aliases libc based resolving. ---------------------------------------------------------------------- jl · 2011-07-03 05:18 Quote from: marcov on July 02, 2011, 10:54:13 pmFirst, try a recent version. Some of these might already have been fixed. Hi Marco, thanks for replying. do you mean Indy v10.5? I tried v10.5.8.0 a month ago. It worked for Windows but on Linux there is a serious iconv bug. So i decided to fix v10.2.0.3 instead.  v10.2.0.3 has enough features and is stable enough on Windows (that's the benchmark). I'm using Indy because some server features such as idsmtpserver is absent in Synapse.