PollCont is a part of UDP implement, the PollCont is directly put into
ET_UDP.

UnixUDPNet.cc:  thread->schedule_every(get_UDPPollCont(thread), -9);

we will duplicate the polling code again on UDP implement if remove
PollCont entirely.

I think the Author of PollCont design it for UDPNetHandler and NetHandler:
    at the beginning of pollEvent(), the code "if (likely(net_handler)) {"

for UDP implement, net_handler is set to NULL
for non-UDP implement, net_hander is set to non-NULL

the PollCont is shared by UDP and non-UDP.

there would be have duplicate code if we remove PollCont.

thus, I'm disagree with you, I think PollCont should keep and nethandler
should call pollEvent and remove dup code.

Oknet Xu

2015-11-02 23:53 GMT+08:00 Alan Carroll <
[email protected]>:

> I've been looking at that and my preference would be to remove PollCont
> entirely. As far as I can tell it exists only to hold the poll descriptor
> data which could easily be promoted to NetHandhandler.
>
>
>
>      On Monday, November 2, 2015 8:14 AM, Chao Xu <[email protected]>
> wrote:
>
>
>  Hi, All!
>
> I'm looking into the iocore source code reading now.
>
> I found the source code from PollCont::pollEvent() is a part of
> NetHandler::mainNetEvent()
> .
>
> And the PollCont is designed to as a abstract class for I/O polling
> operation.
>
> so I have a question: why we duplicate the code in mainNetEvent() rather
> than call pc->pollEvent(event, e) from NetHandler::mainNetEvent() ?
>
> Is it a special design ? or just for print "NetHandler::mainNetEvent" in
> debug log ?
>
> Thanks!
>
> Best Regard,
> Oknet Xu
>
>
>
>

Reply via email to