[openbeosnetteam] more of the soaccept()

So, David, it seems I was totally lost with so->so_head, 
so->so_q and so on?!
Not that I'm surprised...
:-)

Anyway, I should explain the purpose of this strange 
void ** nsp soaccept() argument:

It's the /dev/net/socket driver's net_socket_cookie->cookie field address, 
that soaccept() is expected to set to the struct socket * of the accepted 
socket, so that next operation on this socket will works as expected.
That way, libnet.so accept() would return a valid, file descriptorized, new 
socket handle.

So, may I suggest you to add this little but needed line:

  {
    struct socket *aso = so->so_q;
    if (soqremque(aso, 1) == 0) {
      printf("PANIC: accep!\n");
      return ENOMEM;
    }

  // okay, attach the accepted socket to the driver
  // net_socket_cookie->socket field:
  *nsp = aso;

  so = aso;
  }


Hope this will bring life to accept() support.

-Philippe

Other related posts: