cmdriver/src/CMDriver.cxx
//-------------------------------------------------------------------------------------------
// Loop while not shutting down. Will listen clients socket and administrator socket,
// will process clients and administrator requests if any.
//-------------------------------------------------------------------------------------------
Loop while not shutting down. Will listen clients socket and administrator socket,
will process clients and administrator requests if any.
Loop while not shutting down . Will listen clients socket and administrator socket will process clients and administrator requests if any .
void RequestsLoop(void) {
    int              sockets[3000];
    struct sockaddr  s;
    socklen_t        s_size = sizeof(s);
    do {
        int amount = MakeSocketsArray(Connection.m_DriversListeningSocket,sockets);
        WaitSocket(sockets,amount); 
        for(int i=0; i<m_DriversNum;i++) {
            if(CheckSocketForRead(Connection.m_DriversListeningSocket[i])) {
                int cli_connection = accept(Connection.m_DriversListeningSocket[i], &s, &s_size);
                int tmp_switch = 1;
                setsockopt(cli_connection, IPPROTO_TCP, TCP_NODELAY, 
                           (char *)&tmp_switch, sizeof(tmp_switch));
                if(cli_connection >= 0) {
                    _DBG(fprintf(log_fd,"Connecting new client.\n"));
                    ConnectClient(cli_connection, &s, i);
                    continue;
                }
            }
        }
        ProcessClients();
    } while(!do_shutdown);
    _DBG(fprintf(log_fd, "Requests loop finished.\n"));
}
void RequestsLoop ( void ) { int sockets [ 3000 ] ; struct sockaddr s ; socklen_t s_size = sizeof ( s ) ; do { int amount = MakeSocketsArray ( Connection . m_DriversListeningSocket , sockets ) ; WaitSocket ( sockets , amount ) ; for ( int i = 0 ; i < m_DriversNum ; i ++ ) { if ( CheckSocketForRead ( Connection . m_DriversListeningSocket [ i ] ) ) { int cli_connection = accept ( Connection . m_DriversListeningSocket [ i ] , & s , & s_size ) ; int tmp_switch = 1 ; setsockopt ( cli_connection , IPPROTO_TCP , TCP_NODELAY , ( char * ) & tmp_switch , sizeof ( tmp_switch ) ) ; if ( cli_connection >= 0 ) { _DBG ( fprintf ( log_fd , " \n " ) ) ; ConnectClient ( cli_connection , & s , i ) ; continue ; } } } ProcessClients ( ) ; } while ( ! do_shutdown ) ; _DBG ( fprintf ( log_fd , " \n " ) ) ; }
Loop while not shutting down.
Loop while not shutting down .
// Performing data translation from the existing client sockets // to the existing model sockets