- s_assert(listener != NULL);
- if(listener == NULL)
- return;
- /*
- * There may be many reasons for error return, but
- * in otherwise correctly working environment the
- * probable cause is running out of file descriptors
- * (EMFILE, ENFILE or others?). The man pages for
- * accept don't seem to list these as possible,
- * although it's obvious that it may happen here.
- * Thus no specific errors are tested at this
- * point, just assume that connections cannot
- * be accepted until some old is closed first.
- */
-
- fd = rb_accept(listener->fd, (struct sockaddr *)&sai, &addrlen);
- if(fd < 0)
- {
- /* Re-register a new IO request for the next accept .. */
- rb_setselect(listener->fd, FDLIST_SERVICE,
- COMM_SELECT_READ, accept_connection, listener, 0);
- return;
- }
-
- /* This needs to be done here, otherwise we break dlines */
- mangle_mapped_sockaddr((struct sockaddr *)&sai);
-
- /*
- * check for connection limit
- * TBD: this is stupid... either we have a socket or we don't. -nenolod
- */
- if((rb_get_maxconnections() - 10) < fd)