@@ -136,7 +136,7 @@ pub struct VhostUserConsoleBackend {
136136 pub ready_to_write : bool ,
137137 pub output_queue : Queue < String > ,
138138 pub stdin : Option < Box < dyn Read + Send + Sync > > ,
139- pub listener : Option < TcpListener > ,
139+ pub tcp_listener : Option < TcpListener > ,
140140 pub stream : Option < Box < dyn ReadWrite + Send + Sync > > ,
141141 pub rx_event : EventFd ,
142142 pub rx_ctrl_event : EventFd ,
@@ -165,15 +165,15 @@ impl VhostUserConsoleBackend {
165165 output_queue : Queue :: new ( ) ,
166166 stdin : None ,
167167 stream : None ,
168- listener : None ,
168+ tcp_listener : None ,
169169 rx_event : EventFd :: new ( EFD_NONBLOCK ) . map_err ( |_| Error :: EventFdFailed ) ?,
170170 rx_ctrl_event : EventFd :: new ( EFD_NONBLOCK ) . map_err ( |_| Error :: EventFdFailed ) ?,
171171 exit_event : EventFd :: new ( EFD_NONBLOCK ) . map_err ( |_| Error :: EventFdFailed ) ?,
172172 mem : None ,
173173 } )
174174 }
175175
176- pub fn assign_input_method ( & mut self , tcpaddr_str : String ) -> Result < ( ) > {
176+ pub fn assign_input_method ( & mut self , vm_sock : String ) -> Result < ( ) > {
177177 if self . controller . read ( ) . unwrap ( ) . backend == BackendType :: Nested {
178178 // Enable raw mode for local terminal if backend is nested
179179 enable_raw_mode ( ) . expect ( "Raw mode error" ) ;
@@ -185,7 +185,7 @@ impl VhostUserConsoleBackend {
185185 Self :: epoll_register ( self . epoll_fd . as_raw_fd ( ) , stdin_fd, epoll:: Events :: EPOLLIN )
186186 . map_err ( |_| Error :: EpollAdd ) ?;
187187 } else {
188- let listener = TcpListener :: bind ( tcpaddr_str ) . expect ( "Failed bind tcp address" ) ;
188+ let listener = TcpListener :: bind ( vm_sock ) . expect ( "Failed bind tcp address" ) ;
189189 self . listener = Some ( listener) ;
190190 }
191191 Ok ( ( ) )
@@ -531,7 +531,7 @@ impl VhostUserConsoleBackend {
531531
532532 if self . controller . read ( ) . unwrap ( ) . backend == BackendType :: Network {
533533 let listener_fd = self
534- . listener
534+ . tcp_listener
535535 . as_ref ( )
536536 . expect ( "Failed get tcp listener ref" )
537537 . as_raw_fd ( ) ;
@@ -573,7 +573,7 @@ impl VhostUserConsoleBackend {
573573 fn create_new_stream_thread ( & mut self ) {
574574 // Accept only one incoming connection
575575 if let Some ( stream) = self
576- . listener
576+ . tcp_listener
577577 . as_ref ( )
578578 . expect ( "Failed get tcp listener ref" )
579579 . incoming ( )
@@ -582,7 +582,7 @@ impl VhostUserConsoleBackend {
582582 match stream {
583583 Ok ( stream) => {
584584 let local_addr = self
585- . listener
585+ . tcp_listener
586586 . as_ref ( )
587587 . expect ( "No listener" )
588588 . local_addr ( )
@@ -600,7 +600,7 @@ impl VhostUserConsoleBackend {
600600
601601 let stream: Box < dyn ReadWrite + Send + Sync > = Box :: new ( stream) ;
602602 self . stream = Some ( stream) ;
603- self . write_tcp_stream ( ) ;
603+ self . write_stream ( ) ;
604604 }
605605 Err ( e) => {
606606 eprintln ! ( "Stream error: {}" , e) ;
@@ -609,7 +609,7 @@ impl VhostUserConsoleBackend {
609609 }
610610 }
611611
612- fn write_tcp_stream ( & mut self ) {
612+ fn write_stream ( & mut self ) {
613613 if self . stream . is_some ( ) {
614614 while self . output_queue . size ( ) > 0 {
615615 let byte_stream = self
@@ -630,13 +630,13 @@ impl VhostUserConsoleBackend {
630630 }
631631 }
632632
633- fn read_tcp_stream ( & mut self ) {
633+ fn read_stream ( & mut self ) {
634634 let mut buffer = [ 0 ; 1024 ] ;
635635 match self . stream . as_mut ( ) . expect ( "No stream" ) . read ( & mut buffer) {
636636 Ok ( bytes_read) => {
637637 if bytes_read == 0 {
638638 let local_addr = self
639- . listener
639+ . tcp_listener
640640 . as_ref ( )
641641 . expect ( "No listener" )
642642 . local_addr ( )
@@ -785,7 +785,7 @@ impl VhostUserBackendMut for VhostUserConsoleBackend {
785785 if self . controller . read ( ) . unwrap ( ) . backend == BackendType :: Nested {
786786 return self . read_char_thread ( ) ;
787787 } else {
788- self . read_tcp_stream ( ) ;
788+ self . read_stream ( ) ;
789789 return Ok ( ( ) ) ;
790790 }
791791 }
@@ -1428,7 +1428,7 @@ mod tests {
14281428 . output_queue
14291429 . add ( "Test" . to_string ( ) )
14301430 . unwrap ( ) ;
1431- vu_console_backend. write_tcp_stream ( ) ;
1431+ vu_console_backend. write_stream ( ) ;
14321432
14331433 // All data has been consumed by the cursor
14341434 assert_eq ! ( vu_console_backend. output_queue. size( ) , 0 ) ;
0 commit comments