On Mon, Jan 31, 2011 at 11:11:50AM -0200, Christiano F. Haesbaert wrote:
> On Fri, Jan 28, 2011 at 11:06:40PM -0200, Christiano F. Haesbaert wrote:
> > On Thu, Jan 27, 2011 at 10:00:09AM +0000, Nicholas Marriott wrote:
> > > Hi
> > > 
> > > Out of interest, does the same happen if you export EVENT_NOKQUEUE to
> > > force libevent to use poll?
> > > 
> > 
> > Yes, same thing happens.
> > 
> 

This isn't a bug it's the normal behaviour of an  udp socket:

/* can we write something to so? */
#define sowriteable(so) \
    ((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \
        (((so)->so_state & SS_ISCONNECTED) || \
          ((so)->so_proto->pr_flags & PR_CONNREQUIRED)==0)) || \
    ((so)->so_state & SS_CANTSENDMORE) || (so)->so_error)

When sowritable is called, udp will always eval to true since no data is kept on
the socket buffer, the udp send socket buffer data gets copied into the outbound
mbuf and it's then always ready to accept more data. Which isn't the case with
tcp since it must retain data in the socket buffer for retransmissions and so
on. 

The only way to fix this is probably through a lot of code, sowritable can't
guarantee that an mbuf will be available for udp_output() in it's M_PREPEND
call. This should be documented somewhere.

My solution by now it's just to try again in the application when we have an
ENOBUFS.
-- 
Christiano Farina HAESBAERT
Do NOT send me html mail.

Reply via email to