Interface Patch

Tomash Brechko tomash.brechko at gmail.com
Mon Feb 4 09:49:51 UTC 2008


On Mon, Feb 04, 2008 at 00:44:49 -0800, Brian Aker wrote:
> I found that bit when looking through the libevent mailing lists. The  
> previous call that would generate the error will be a system call.

This is always a subject to change, better not to relay on it.


> That seemed a bit of a hack to do it that way (aka keeping first  
> element for size). The count bit can go away in the future if the loop  
> for socket creation/event creation is factored into one. You still  
> need both success and count though. You could turn the entire object ino

I didn't suggest to use first elem for counter.  Just don't let the
counter variable go away.  It's not a hack to have an array and a
counter to tell how much of it is being used.  It's actually a
"pattern" ;).


> For instance this:
>             if (errno != EADDRINUSE) {
>                 perror("bind()");
>                 /* If we are not at the first element, loop back and  
> close all sockets */
>                 if (sfd_ptr != sfd_list) {
>                     --sfd_ptr;
>                     do {
>                         close(*sfd_ptr);
>                         --sfd_ptr;
>                     } while (sfd_ptr != sfd_list);

This do { } while loop won't close sfd_list[0] (and the first if()
would also skip over the just created socket too).  Use the loop from
my mail ;).


Alright, I think it would be better to have the whole patch set that
implements multiple listening sockets for all protocol families, and
then to review all sequence at once.  Otherwise we just discussing how
the final solution will look like, and how it will cover the holes in
the partial solution at hand.


-- 
   Tomash Brechko


More information about the memcached mailing list