Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About Indy 10 TIdTCPServer and ramdom disconections
#3
Wow, Remy, I have lots of questions, but I'll be brief.

I think I was wrong about TidSync. I thought that a class(TidSync) runs itself, putting the rest of the connections on hold, until it finishes its job.

In fact -correct me if I am wrong- TidTCPServer.OnExecute executes every connection, that the server receives. So this block of code.

TidTCPServer.OnExecute
Code:
begin
      if not Server.Active then
        exit;

      ClientIPAddr := AContext.Binding.PeerIP;    //ip
      xComando.Linea := fxLeerLinea; //read the line
      if xComando.Linea = '' then
      begin
        LimpiamosBuffer(AContext); //clean up buffer
        exit;
      end;

      xComando.EsXML := fxEsXML( xComando.Linea ); //is an xml what is coming?

      if xComando.EsXML then
        TManejoPaquetesDOM.Procesa( xComando.Linea, Acontext, Server ) //process all my structure for taht connection
      else
      begin
        TumbarIP(ClientIPAddr);    //clean the connection
        exit;
      end;
      xComando.Linea := ''; //clean line
end;


So, the line

TMManagePackagesDOM.Process( xCommand.Line, Acontext, Server )

is executed for each connection that sends something to the server.

I thought "TManagePackagesDOM.Process(..)", because it's TidSync, it executes and put everything that entered OnExecute on hold, until it's finished. That's why I synchronize it.

So,

A) whether I synchronize or not, Do I have to protect all the data structures accessed by all my threads and everything that is touched inside TMManagePackagesDOM.Process(..) ?

I ask this because of what you say

"Then don't synchronize your processing. Only synchronize access to shared resources, like your TList, but do the actual processing outside of the syncs." (...)

and

"Then why are you synchronizing your processing if it is providing its own thread safety?"

B)
I am interested in this "Keep Alive" topic. I use it to keep licenses alive. But this point you say

"..Or even enabling TCP-level keep-alives on the connection itself."

Do dou have some example about this?

Regards, and thank you very much, my friend.

Pablo Romero
Cordoba - Argentina
Reply


Messages In This Thread
RE: About Indy 10 TIdTCPServer and ramdom disconections - by PabloRomero - 12-02-2023, 11:26 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)