[Libwebsockets] Question about max_fd check in insert_wsi_socket_into_fds

Subi S S subi.s at cambiumnetworks.com
Tue Apr 28 14:26:04 CEST 2015

insert_wsi_socket_into_fds(struct libwebsocket_context *context,
                                                       struct libwebsocket *wsi)
        struct libwebsocket_pollargs pa = { wsi->sock, LWS_POLLIN, 0 };

        if (context->fds_count >= context->max_fds) {
                lwsl_err("Too many fds (%d)\n", context->max_fds);
                return 1;

        if (wsi->sock >= context->max_fds) { --------------------------------> Whether this check is really needed, in some system I found wsi->sock is really high , is it safe to remove this ?
                lwsl_err("Socket fd %d is too high (%d)\n",
                                                wsi->sock, context->max_fds);
                return 1;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20150428/997b4bf1/attachment.html>

More information about the Libwebsockets mailing list