Re: [MERGE] Cleanup, the client_side part

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Thu, 11 Sep 2008 23:35:38 +1200

Alex Rousskov wrote:
> Cleaned up ConnStateData's closing and destruction.
>
> 1) Despite its name and the "if (open) close" use in ConnStateData
> destructor, ConnStateData::close() was not closing anything. It was
> called from the Comm close handler and from the destructor and would
> attempt to immediately delete the ConnStateData object. Protecting code
> in deleteThis() may have prevented the actual [double] delete from
> happening, but it is difficult to say exactly what was going on when the
> close() method was being called from the destructor.
>
> I converted ConnStateData::close to swanSong, which is the standard
> AsyncJob cleanup method. As before, the method does not close anything
> (which may still be wrong). The swanSong method is never called directly
> by the user code. It is called by lower layers just before the job is
> destroyed. The updated close handler initiates job destruction by
> calling deleteThis().
>
> We may need to add Comm closing code to swanSong. For now, the updated
> ConnStateData destructor will warn if ConnStateData forgot to close the
> connection. The destructor will also warn if swanSong was not called,
> which would mean that the job object is being deleted incorrectly.
>
>
> 2) Polished ClientSocketContext::writeComplete to distinguish
> STREAM_UNPLANNED_COMPLETE from STREAM_FAILED closing state. This helps
> when looking at stack traces.
>
>
> 3) Added an XXX comment about duplicated code.
>
>
> 4) Documented ClientSocketContext::initiateClose purpose and context.
>
>

bb:approve

Amos

-- 
Please use Squid 2.7.STABLE4 or 3.0.STABLE8
Received on Thu Sep 11 2008 - 11:35:51 MDT

This archive was generated by hypermail 2.2.0 : Thu Sep 11 2008 - 12:00:12 MDT