Mailing List Archive

stream_read() bug?
Hi!

I am busy writing a small socket api for bgpd to lookup as paths and other
routing info from external applications and while looking at the code I
realised that stream_read() will only return if size bytes were read (even
on a non-blocking socket which means it will busy-loop).

I am pretty sure this was not the intention. If it was why even bother with
non-blocking sockets at all (e.g. the one used between zebra and the other
daemons, e.g. bgpd).

Even worse, it doesn't look like stream_read() can be modified to
return with less than size bytes since some code depend on the current
[broken] behaviour, e.g. zserv.c in zebra.

--

Regards
Abraham

TODAY the Pond!
TOMORROW the World!
-- Frogs (1972)

___________________________________________________
Abraham vd Merwe - Frogfoot Networks CC
1st Floor, Albion Springs, 183 Main Road, Newlands
Phone: +27 21 689 3876 Cell: +27 82 565 4451
Http: http://www.frogfoot.net/ Email: abz@frogfoot.net
Re: stream_read() bug? [ In reply to ]
On Fri, Jul 09, 2004 at 07:54:08PM +0200, Abraham van der Merwe wrote:
> I am busy writing a small socket api for bgpd to lookup as paths and other
> routing info from external applications and while looking at the code I
> realised that stream_read() will only return if size bytes were read (even
> on a non-blocking socket which means it will busy-loop).

Why do you say that? stream_read() calls readn() once.
And readn() returns immediately if the return code from read() is
negative (which it would be when no data is available on a
non-blocking socket).

Or am I missing something?

-Andy