On 18/01/2013 5:37 p.m., Alex Rousskov wrote:
On 01/17/2013 06:35 PM, Amos Jeffries wrote:
Amos, do you remember what "partially open FD" in the following comment
meant, exactly? Why cannot we just call comm_close() to cleanup?
It means we have issued socket() and connect() OS calls. fd_table[]
state probably exists. But we are still waiting on either TCP response,
or the In-Progress event to run and the FD to be confirmed as open.
  This is signalled by (temporaryFd_ >= 0).
Why cannot we just call comm_close() to cleanup Comm state?

Because comm_openex() and comm_close() are not "symmetrical" in what they do. comm_close() involves a lot of handlers cleanup and close code for state objects which simply do not exist yet.

The FD has only had socket() and connect() done on it and a few specific things done to the fd_table. One of which is registering the calls_.earlyAbort_ handler as what gets run on comm_close() in case the Squid shutdown/restart sequence or TCP close happens during this Jobs operations. If we use comm_close() most of the required cleanup will never happen.

Amos

Reply via email to