[PATCH 2/3] Fix issue where cli socket buffer may get full

Ondrej Zajicek santiago at crfreenet.org
Wed Jun 12 17:42:16 CEST 2019


On Wed, Jun 12, 2019 at 07:29:51AM +0000, Kenth Eriksson wrote:
> > Also, better way to handle 1/3 is to add condition on line io.c line
> > 2211, so that if we have full buffer, we do not try to check POLLIN,
> > so that we do not even call sk_read() in such case instead of try it
> > to handle from inside sk_read().
> > 
> Ok, I can update patch 1/3 so that is not included in the pollset if
> the io buffer is full. Will repost, so that you can review. But I still
> don't see reading 0 shall close the socket as reading 0 is not an
> error. Shall we combine the two patches to get a more robust solution?

My position is that sk_read() should depend on result of internal read()
and not on external information like POLLIN status.

But how to distinguish reading 0 as a result of socket close from other
cases? Also, the issue of empty buffer could be simply handled by return
0 from sk_read() just before the read(). If there is no space in buffer,
then there is no point to call read().

I will look at the patches and merge something reasonable.

-- 
Elen sila lumenn' omentielvo

Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."


More information about the Bird-users mailing list