netpoll icon indicating copy to clipboard operation
netpoll copied to clipboard

why `fill` is called after connection is inactive

Open WineChord opened this issue 3 years ago • 1 comments

image

When connection is inactive (mybe closed by peer or closed in another client goroutine), the logic will reach L395 to check whether fd is still valid. If it is, netpoll tries to read data from fd and further process the data using user's onRequest handler. However, we can see that if we call Close on the connection, it will also close the underlying netfd. Therefore the logic of fill here seems try to grasp some concurrency gap, and read the rest of the data in fd as much as possible. But I wonder if it is really necessary or if there are some real world scenarios that highly depend on this treatment in order to function properly.

Correct me if I was wrong. Thx.

WineChord avatar Jun 02 '22 09:06 WineChord

Close has two entries, c.onHup and c.onClose, search the code and see details please.

Hchenn avatar Jun 02 '22 09:06 Hchenn