/// Fill the Arrow Protocol output buffer with data from session input 
/// buffers.
Fill the Arrow Protocol output buffer with data from session input
buffers.
Fill the Arrow Protocol output buffer with data from session input buffers .
fn fill_output_buffer(&mut self, event_loop: &mut EventLoop<Self>) {
        // using round robin alg. here in order to avoid session read 
        // starvation
        let mut queue_size = self.session_queue.len();
        while queue_size > 0 && !self.output_buffer.is_full() {
            if let Some(session_id) = self.session_queue.pop_front() {
                if let Some(ctx) = self.sessions.get_mut(&session_id) {
                    // avoid sending empty packets
                    let len = if ctx.input_ready() {
                        let data = ctx.input_buffer();
                        let len  = cmp::min(32768, data.len());
                        let arrow_msg = ArrowMessage::new(
                            ctx.service_id, ctx.session_id, 
                            &data[..len]);
                        if self.output_buffer.is_empty() {
                            self.write_tout.set(CONNECTION_TIMEOUT);
                        }
                        arrow_msg.serialize(&mut self.output_buffer)
                            .unwrap();
                        len
                    } else {
                        0
                    };
                    ctx.drop_input_bytes(len, event_loop);
                    self.session_queue.push_back(session_id);
                    //log_debug!(self.logger, "{} bytes moved from session {:08x} input buffer into the Arrow output buffer", len, session_id);
                }
            }
            queue_size -= 1;
        }
    }
fn fill_output_buffer ( & mut self , event_loop : & mut EventLoop < Self > ) { // using round robin alg. here in order to avoid session read  // starvation let mut queue_size = self . session_queue . len ( ) ; while queue_size > 0 && ! self . output_buffer . is_full ( ) { if let Some ( session_id ) = self . session_queue . pop_front ( ) { if let Some ( ctx ) = self . sessions . get_mut ( & session_id ) { // avoid sending empty packets let len = if ctx . input_ready ( ) { let data = ctx . input_buffer ( ) ; let len = cmp :: min ( 32768 , data . len ( ) ) ; let arrow_msg = ArrowMessage :: new ( ctx . service_id , ctx . session_id , & data [ .. len ] ) ; if self . output_buffer . is_empty ( ) { self . write_tout . set ( CONNECTION_TIMEOUT ) ; } arrow_msg . serialize ( & mut self . output_buffer ) . unwrap ( ) ; len } else { 0 } ; ctx . drop_input_bytes ( len , event_loop ) ; self . session_queue . push_back ( session_id ) ; //log_debug!(self.logger, "{} bytes moved from session {:08x} input buffer into the Arrow output buffer", len, session_id); } } queue_size -= 1 ; } }
Fill the Arrow Protocol output buffer with data from session input
buffers.
Fill the Arrow Protocol output buffer with data from session input buffers .
&mut self
event_loop
&mut EventLoop<Self>