[Asterisk-Dev] Re: EAGAIN rtp.c

Wolfgang S. Rupprecht list+asterisk-dev at lists.wsrcc.com
Tue Jul 13 00:40:47 MST 2004


dking at pimpsoft.com writes:
> Why not test the servers input buffer? If its null and EAGAIN is 
> returned, then there is no data.
> 
> If its full or has something in it and EAGAIN was returned  then 
> there was a error.
> 
>  Either way the extra conditional needed to find out whats going on 
> exists right?
> 
> Perhapsn that will be the best for you as well?

I'm not sure that's right either.  The errno variable isn't valid
unless the count returned is negative (hence you can't have any
returned data).

Treating EAGAIN as an error and printing something is against the
spirit of that return value.  It is supposed to be a good return value
that means "There is no data this time, but you are encouraged to try
it again.  There is nothing that will prevent it from working the next
time."

-wolfgang
-- 
Wolfgang S. Rupprecht                http://www.wsrcc.com/wolfgang/
openbsd amd64 http://www.wsrcc.com/wolfgang/ftp/asterisk-openbsd35.patch



More information about the asterisk-dev mailing list