You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: tcp_listener.rs
    path of file: ./repos/CYFS/src/component/cyfs-lib/src/base
    
    the code of the file until where you have to start completion: use cyfs_base::{BuckyError, BuckyResult};
use cyfs_debug::Mutex;

use async_std::net::{TcpListener, TcpStream};
use async_std::stream::StreamExt;
use async_std::task;
use futures::future::{AbortHandle, Aborted};
use std::net::SocketAddr;
use std::sync::Arc;
use once_cell::sync::OnceCell;


#[async_trait::async_trait]
pub trait BaseTcpListenerHandler: Send + Sync {
    async fn on_accept(&self, stream: TcpStream) -> BuckyResult<()>;
}

pub type BaseTcpListenerHandlerRef = Arc<Box<dyn BaseTcpListenerHandler>>;

struct BaseTcpListenerInner {
    listen: SocketAddr,

    handler: OnceCell<BaseTcpListenerHandlerRef>,

    // 取消listener的运行
    canceler: Option<AbortHandle>,

    running_task: Option<async_std::task::JoinHandle<()>>,
}

impl BaseTcpListenerInner {
    pub fn new(listen: SocketAdd
    
    async fn run_inner(&self, tcp_listener: TcpListener) -> BuckyResult<()> {
        let listen;
        let handler;
        {
            let listener = self.0.lock().unwrap();

            listen = listener.listen.clone();
            handler = listener.handler.get().unwrap().clone();
        }

        let addr = format!("http://{}", tcp_listener.local_addr().unwrap());
        info!("tcp listener listen at {}", addr);

        let mut incoming = tcp_listener.incoming();
        loop {
            match incoming.next().await {
                Some(Ok(tcp_stream)) => {
                    debug!(
                        "tcp listener recv new connection from {:?}",
                        tcp_stream.peer_addr()
                    );

                    let handler = handler.clone();
                    task::spawn(async move {
                        if let Err(e) = handler.on_accept(tcp_stream).await {
                            error!(
                                "object tcp process http connection error: listen={} err={}",
                                listen, e
                            );
                        }
                    });
                }
                Some(Err(e)) => {
                    // FIXME 返回错误后如何处理？是否要停止
                    let listener = self.0.lock().unwrap();
                    error!(
                        "tcp listener recv connection error! listener={}, err={}",
                        listener.listen, e
                    );
                }
                None => {
                    info!("tcp listener recv connection finished! listen={}", listen);
                    break;
                }
            }
        }

        Ok(())
    }