pub fn start_server(ip: String, port: i32, dir: StaticFiles) {
    let address = format!("{}:{}", ip, port);

    let (mut incoming_q, mut reading_q, mut writing_q) = match create_qs(dir) {
        Ok(qs) => qs,
        Err(error) => {
            println!("{}", error);
            return;
        }
    };


    let listener = match TcpListener::bind(address) {
        Ok(listener) => listener,
        Err(err) => panic!(err)
    };

    match listener.set_nonblocking(true) {
        Err(err) => panic!(err),
        _ => {}
    };

    let listener_event = ListenerEvent::new(listener, [0; 2048]);
    let worked = incoming_q.add(listener_event);
    if let Err(_) = worked {
        println!("Could not accept connection.")
    }

    loop {
        if reading_q.events.len() > 0 {
            handle_reading(&mut reading_q, &mut writing_q)
        }
        if writing_q.events.len() > 0 {
            handle_writing(&mut writing_q)
        }
        if incoming_q.events.len() > 0 {
            handle_incoming(&mut incoming_q, &mut reading_q)
        }
    }
}
/// Starts the event loop server
///
/// The server is listening for incoming connections.
/// When a stream is available it reads its content performs the mapping to the dir
/// and returns the response.
/// Waiting for the stream to be ready, reading data from it and then writing it back into the response is done nonblocking.
/// This does not mean that the whole server works nonblocking.
/// It is always actively looking for work, but when work arrives, but would block,
/// it continues on other work.
/// In a future update it will even wait passively, if no work is available.
Starts the event loop server
The server is listening for incoming connections.
When a stream is available it reads its content performs the mapping to the dir
and returns the response.
Waiting for the stream to be ready, reading data from it and then writing it back into the response is done nonblocking.
This does not mean that the whole server works nonblocking.
It is always actively looking for work, but when work arrives, but would block,
it continues on other work.
In a future update it will even wait passively, if no work is available.
Starts the event loop server The server is listening for incoming connections . When a stream is available it reads its content performs the mapping to the dir and returns the response . Waiting for the stream to be ready reading data from it and then writing it back into the response is done nonblocking . This does not mean that the whole server works nonblocking . It is always actively looking for work but when work arrives but would block it continues on other work . In a future update it will even wait passively if no work is available .
pub fn start_server(ip: String, port: i32, dir: StaticFiles) {
    let address = format!("{}:{}", ip, port);
    let (mut incoming_q, mut reading_q, mut writing_q) = match create_qs(dir) {
        Ok(qs) => qs,
        Err(error) => {
            println!("{}", error);
            return;
        }
    };
    let listener = match TcpListener::bind(address) {
        Ok(listener) => listener,
        Err(err) => panic!(err)
    };
    match listener.set_nonblocking(true) {
        Err(err) => panic!(err),
        _ => {}
    };
    let listener_event = ListenerEvent::new(listener, [0; 2048]);
    let worked = incoming_q.add(listener_event);
    if let Err(_) = worked {
        println!("Could not accept connection.")
    }
    loop {
        if reading_q.events.len() > 0 {
            handle_reading(&mut reading_q, &mut writing_q)
        }
        if writing_q.events.len() > 0 {
            handle_writing(&mut writing_q)
        }
        if incoming_q.events.len() > 0 {
            handle_incoming(&mut incoming_q, &mut reading_q)
        }
    }
}
pub fn start_server ( ip : String , port : i32 , dir : StaticFiles ) { let address = format ! ( " " ip port ) ; let ( mut incoming_q , mut reading_q , mut writing_q ) = match create_qs ( dir ) { Ok ( qs ) => qs , Err ( error ) => { println ! ( " " error ) ; return ; } } ; let listener = match TcpListener :: bind ( address ) { Ok ( listener ) => listener , Err ( err ) => panic ! ( err ) } ; match listener . set_nonblocking ( true ) { Err ( err ) => panic ! ( err ) , _ => { } } ; let listener_event = ListenerEvent :: new ( listener , [ 0 ; 2048 ] ) ; let worked = incoming_q . add ( listener_event ) ; if let Err ( _ ) = worked { println ! ( " " ) } loop { if reading_q . events . len ( ) > 0 { handle_reading ( & mut reading_q , & mut writing_q ) } if writing_q . events . len ( ) > 0 { handle_writing ( & mut writing_q ) } if incoming_q . events . len ( ) > 0 { handle_incoming ( & mut incoming_q , & mut reading_q ) } } }
Starts the event loop server
The server is listening for incoming connections.
Starts the event loop server The server is listening for incoming connections .
ip
String
port
i32
dir
StaticFiles
ip
String
port
i32
dir
StaticFiles