Newsgroups : Borland : borland.public.delphi.internet.winsock : 2008 Feb : Re: Indy bug?
| Subject: | Re: Indy bug? |
| Posted by: | "turan kolin" (no..@none.com) |
| Date: | 20 Feb 2008 02:39:15 |
I use delphi 5,Indy 9.0.50 and windows 2003 server.
No I am sure Tidpeerthread can not free clearly.(only maxconnections property) And I can see on task manager.
procedure TIdListenerThread.Run;
......
.....
if (Server.MaxConnections > 0) and // Check MaxConnections
NOT TIdThreadSafeList(Server.Threads).IsCountLessThan(Server.MaxConnections)
then begin
//Do not UpdateText here - in thread. Is done in constructor
LPeer.WriteRFCReply(Server.MaxConnectionReply);
LPeer.Disconnect;
Server.ThreadMgr.ReleaseThread(LThread); // Give the thread back to the thread-manager
end else begin
Server.Threads.Add(LThread); //APR
// Start Peer Thread
LThread.Start;
Break;
end;
..........
That I show above is your indy code.
Server.ThreadMgr.ReleaseThread(LThread); ---> Lthread is being free.
destructor TIdThread.Destroy;---->Cleanup;---->calls ThreadMgr.ReleaseThread
So this method is called twice.
procedure TIdThreadMgrDefault.ReleaseThread(AThread: TIdThread);
begin
with ActiveThreads.LockList do try // To avoid ReleaseThread-code is
if IndexOf(AThread)=-1 then exit; // executed multiple times, because
finally // AThread.Free call ReleaseThread
ActiveThreads.UnlockList; // again. Now we will detect the 2nd
end; // time, and jump out of the routine
but above code prevents any error.
I can not examine all indy code.But I want to find problem.
For example tidtcpserver.maxconnections:=1 and one client is being connected.Other client try to connect and
it is being prevented by indy.And thread counts of application increase.And if I close the server application "destructor TIdThread.Destroy;" methods are being
called twice. I think other thread can be only free while closing.
TMXpeerthread=class(tidpeerthread)
........
constructor Create(ACreateSuspended: Boolean = True);override;
destructor Destroy; override;
end;
destructor TMXPeerThread.Destroy;
begin
.....
inherited;
end;
"Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> wrote:
>
>"turan kolin" <none@none.com> wrote in message
>news:47b98e94$1@newsgroups.borland.com...
>
>> Tidtcpserver---> maxconnections:=3
>> While 3 users be connected if an other user want to connect,
>> indy does not give permit. But indy can not terminate this Thread.
>
>There will not be any thread created for that user to begin with. When
>MaxConnections has been reached, new clients are accepted and then
>disconnected right away without creating a new thread to manage the
>connection.
>
>> I tested this with task manager. Every connection attempt is increase
>> threads count!
>
>It should not be, since no threads are created.
>
>
>Gambit