src/mca/oob/tcp/oob_tcp_listener.c
/*
 * Handler for accepting connections from the event library
 */
Handler for accepting connections from the event library
Handler for accepting connections from the event library
static void connection_event_handler(int incoming_sd, short flags, void *cbdata)
{
    struct sockaddr addr;
    prte_socklen_t addrlen = sizeof(struct sockaddr);
    int sd;
    sd = accept(incoming_sd, (struct sockaddr *) &addr, &addrlen);
    prte_output_verbose(OOB_TCP_DEBUG_CONNECT, prte_oob_base_framework.framework_output,
                        "%s connection_event_handler: working connection "
                        "(%d, %d) %s:%d\n",
                        PRTE_NAME_PRINT(PRTE_PROC_MY_NAME), sd, prte_socket_errno,
                        prte_net_get_hostname((struct sockaddr *) &addr),
                        prte_net_get_port((struct sockaddr *) &addr));
    if (sd < 0) {
        if (EINTR == prte_socket_errno || EAGAIN == prte_socket_errno
            || EWOULDBLOCK == prte_socket_errno) {
            return;
        }
        else if (EMFILE == prte_socket_errno) {
            CLOSE_THE_SOCKET(incoming_sd);
            PRTE_ERROR_LOG(PRTE_ERR_SYS_LIMITS_SOCKETS);
            prte_show_help("help-oob-tcp.txt", "accept failed", true, prte_process_info.nodename,
                           prte_socket_errno, strerror(prte_socket_errno),
                           "Out of file descriptors");
            prte_errmgr.abort(PRTE_ERROR_DEFAULT_EXIT_CODE, NULL);
            return;
        }
        else {
            CLOSE_THE_SOCKET(incoming_sd);
            prte_show_help("help-oob-tcp.txt", "accept failed", true, prte_process_info.nodename,
                           prte_socket_errno, strerror(prte_socket_errno),
                           "Unknown cause; job will try to continue");
            return;
        }
    }
    prte_oob_tcp_module.accept_connection(sd, &addr);
}
static void connection_event_handler ( int incoming_sd , short flags , void * cbdata ) { struct sockaddr addr ; prte_socklen_t addrlen = sizeof ( struct sockaddr ) ; int sd ; sd = accept ( incoming_sd , ( struct sockaddr * ) & addr , & addrlen ) ; prte_output_verbose ( OOB_TCP_DEBUG_CONNECT , prte_oob_base_framework . framework_output , " " " \n " , PRTE_NAME_PRINT ( PRTE_PROC_MY_NAME ) , sd , prte_socket_errno , prte_net_get_hostname ( ( struct sockaddr * ) & addr ) , prte_net_get_port ( ( struct sockaddr * ) & addr ) ) ; if ( sd < 0 ) { if ( EINTR == prte_socket_errno || EAGAIN == prte_socket_errno || EWOULDBLOCK == prte_socket_errno ) { return ; } else if ( EMFILE == prte_socket_errno ) { CLOSE_THE_SOCKET ( incoming_sd ) ; PRTE_ERROR_LOG ( PRTE_ERR_SYS_LIMITS_SOCKETS ) ; prte_show_help ( " " , " " , true , prte_process_info . nodename , prte_socket_errno , strerror ( prte_socket_errno ) , " " ) ; prte_errmgr . abort ( PRTE_ERROR_DEFAULT_EXIT_CODE , NULL ) ; return ; } else { CLOSE_THE_SOCKET ( incoming_sd ) ; prte_show_help ( " " , " " , true , prte_process_info . nodename , prte_socket_errno , strerror ( prte_socket_errno ) , " " ) ; return ; } } prte_oob_tcp_module . accept_connection ( sd , & addr ) ; }
Handler for accepting connections from the event library
Handler for accepting connections from the event library
/* Non-fatal errors */ /* If we run out of file descriptors, log an extra warning (so
           that the user can know to fix this problem) and abandon all
           hope. */ /* For all other cases, close the socket, print a warning but
           try to continue */ /* process the connection */