[sheepdog] [PATCH V2 1/2] sheep: simplify client_decref() and move it into free_request() and add a helper function

Yunkai Zhang yunkai.me at gmail.com
Fri Jul 6 13:44:19 CEST 2012


On Fri, Jul 6, 2012 at 7:14 PM, Liu Yuan <namei.unix at gmail.com> wrote:
> On 07/06/2012 06:56 PM, Yunkai Zhang wrote:
>>> Better assign fd = -1 in unregister_event() and then we can check it
>> No, this fd need to be closed by destroy_client() when ci->refcnt become zero.
>>
>
> If fd is dead connection, why not we close it as soon as possible?

I have ever wanted to close it directly,  but I found that this fd is
inflight, then worker thread may use it at the same time. If we close
it directly, the value of this fd maybe reused by system, then worker
thread may use wrong fd to do something (at least we now have no rule
to prevent worker thread using it).

>
> Thanks,
> Yuan
>



-- 
Yunkai Zhang
Work at Taobao



More information about the sheepdog mailing list